GetInputTensor

Function Usage

Obtains the pointer to an input tensor 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

1
const Tensor *GetInputTensor(const size_t index) const

Parameters

Parameter

Input/Output

Description

index

Input

Input index, starting from 0.

Returns

Input tensor pointer. If the index is invalid, 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->GetInputTensor(1U)->GetData<uint8_t>();
  EXPECT_EQ(data[0], 85);
  // ...
}