GetOptionalInputTensor
Function Usage
Obtains the pointer to an optional input tensor based on the input index in the operator prototype definition.
Prototype
1 | const Tensor *GetOptionalInputTensor(const size_t ir_index) const |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
ir_index |
Input |
Index of the input in the operator IR prototype definition, starting from 0. |
Returns
Pointer to the input tensor. If the index is invalid or the input is not instantiated, a null pointer is returned.
For details about the definition of the tensor type, see Tensor.
Constraints
None
Examples
1 2 3 4 5 | ge::graphStatus InferFormatForXXX(InferFormatContext *context) { const auto data = context->GetOptionalInputTensor(1U)->GetData<uint8_t>(); EXPECT_EQ(data[0], 85); // ... } |
Parent topic: InferFormatContext