GetInputDesc
Description
Obtains the input tensor description based on the operator input index. The input index refers to the actual index after operator instantiation, not the index in the prototype definition.
Prototype
const CompileTimeTensorDesc *GetInputDesc(const size_t index) const
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
index |
Input |
Operator input index, starting from 0. |
Returns
Pointer to the input 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->GetComputeNodeInputNum(); ++idx) {
auto input_td = extend_context->GetInputDesc(idx);
...
}
Parent topic: ExtendedKernelContext