shape_quantization.h#
Shape-inference functions for ONNX operators in the quantization family.
-
namespace ONNX_LIGHT_NAMESPACE
-
namespace onnx_optim
-
namespace shapes
-
namespace quantization#
Functions
-
void ComputeShapeQuantizeLinear(ShapesContext &ctx, const NodeProto &node, const char *x, const char *y_zero_point)#
Computes the output :cpp:class:
OptimTensorof aQuantizeLinearnode and stores it inctx.QuantizeLinearproduces an outputythat always has the same shape as the inputx. The output element type is resolved as follows:when
y_zero_pointis supplied (third input, non-empty name) the output dtype is the dtype ofy_zero_point;otherwise, when the
output_dtypeinteger attribute is set (opset 23+), it is interpreted as aTensorProto::DataTypeand mapped to the matching :cpp:enum:TensorType;otherwise the output dtype defaults to
uint8.
The
axis,saturate,block_size, andprecisionattributes do not affect the output shape and are therefore not inspected by this function.- Parameters:
ctx – In/out context. Must already contain entries for
x,y_scale, andy_zero_pointwhen the latter is provided; on return it also contains an entry fornode.output(0).node – The
QuantizeLinearNodeProtowhose output should be described.node.op_type()must be"QuantizeLinear"andnodemust declare at least one output.x – Name of the input value to read from
ctx. Must be present inctx.y_zero_point – Name of the
y_zero_pointinput value, ornullptr/ empty string when the input is omitted. When non-empty it must be present inctx.
- Throws:
-
void ComputeShapeQuantizeLinear(ShapesContext &ctx, const NodeProto &node, const char *x, const char *y_zero_point)#
-
namespace quantization#
-
namespace shapes
-
namespace onnx_optim