Obtains the pointer to a required input tensor range based on the input index in the operator prototype definition.
| Parameter | Input/Output | Description |
|---|---|---|
| ir_index | Input | Index of the required input in the operator IR prototype definition, starting from 0. |
Pointer to the TensorRange type. The definition is as follows:
using TensorRange = Range<Tensor>;
If ir_index is invalid, a null pointer is returned.
If the input is not set as a data dependency, when this API is called to obtain the tensor range, only the correct shape, format, and data type information can be obtained from the tensor. The actual tensor data address cannot be obtained (the obtained address is nullptr).
const auto infer_shape_range_func = [](gert::InferShapeRangeContext *context) -> graphStatus {
auto input_shape_range = context->GetRequiredInputTensorRange(0U);
auto output_shape_range = context->GetOutputShapeRange(0U);
*output_shape_range->GetMin() = input_shape_range->GetMin()->GetStorageShape();
*output_shape_range->GetMax() = input_shape_range->GetMax()->GetStorageShape();
return GRAPH_SUCCESS;
};