Overview
Inherited from ExtendedKernelContext, InferShapeRangeContext is used to obtain the input and output ShapeRange and input TensorRange of an operator. ShapeRange and TensorRange are special types of the Range<T> template, recording the upper and lower limits of the operator shape and tensor values, respectively. Some operators (for example, NonZero) cannot infer the specific output shape during shape inference. The maximum shape can be estimated based on the ShapeRange information only.
The following figure shows the inheritance relationship of InferShapeRangeContext.
Header Files to Be Included
1 | #include <infer_shape_range_context.h> |
Public Member Functions
const Range<Shape> *GetInputShapeRange(const size_t index) const const TensorRange *GetInputTensorRange(const size_t index) const const TensorRange *GetOptionalInputTensorRange(const size_t ir_index) const const TensorRange *GetDynamicInputTensorRange(const size_t ir_index, const size_t relative_index) const const Range<Shape> *GetOptionalInputShapeRange(const size_t ir_index) const const Range<Shape> *GetDynamicInputShapeRange(const size_t ir_index, const size_t relative_index) const const Range<Shape> *GetRequiredInputShapeRange(const size_t ir_index) const const TensorRange *GetRequiredInputTensorRange(const size_t ir_index) const Range<Shape> *GetOutputShapeRange(const size_t index)
Parent topic: InferShapeRangeContext