GetOutputDesc

Description

Obtains the output tensor description based on the operator output index. The output index refers to the actual index after operator instantiation, not the index in the prototype definition.

Prototype

const CompileTimeTensorDesc *GetOutputDesc(const size_t index) const

Parameters

Parameter

Input/Output

Description

index

Input

Operator output index, starting from 0.

Returns

Pointer to the output TensorDesc. If the input index is invalid, a null pointer is returned.

For details about the definition of CompileTimeTensorDesc, see CompileTimeTensorDesc.

Restrictions

None

Example

// Assume that KernelContext *context already exists.
auto extend_context = reinterpret_cast<ExtendedKernelContext *>(context);
for (size_t idx = 0; idx < extend_context->GetComputeNodeInfo()->GetOutputsNum(); ++idx) {
  auto output_td = extend_context->GetOutputDesc(idx);
  ...
}