shape_math.h#
Shape-inference functions for ONNX operators in the math family.
-
namespace ONNX_LIGHT_NAMESPACE
-
namespace onnx_optim
-
namespace shapes#
-
namespace math#
Functions
-
void ComputeShapeAbs(ShapesContext &ctx, const NodeProto &node, const char *x)#
Computes the output :cpp:class:
OptimTensorof anAbsnode and stores it inctx.Absis element-wise and unary in every revision of its schema (v1, v6, v13 — later revisions only widen the accepted dtype set), so the output dtype and shape always match those of the input.- Parameters:
ctx – In/out context. Must already contain an entry for
x; on return it also contains an entry fornode.output(0).node – The
AbsNodeProtowhose output should be described.node.op_type()must be"Abs"andnodemust declare at least one output.x – Name of the input value to read from
ctx. Must be present inctx.
- Throws:
-
void ComputeShapeAdd(ShapesContext &ctx, const NodeProto &node, const char *a, const char *b)#
Computes the output :cpp:class:
OptimTensorof anAddnode and stores it inctx.Addis element-wise and binary, with numpy-style multidirectional broadcasting between its two operands (since opset 7; earlier revisions had an explicitbroadcastattribute but the shape propagation rules are identical when broadcasting is enabled, which onnx-light assumes). The output dtype matches the input dtype (both operands share the same type via theTtype constraint) and the output shape is the broadcast of the two input shapes.- Parameters:
ctx – In/out context. Must already contain entries for both
aandb; on return it also contains an entry fornode.output(0).node – The
AddNodeProtowhose output should be described.node.op_type()must be"Add"andnodemust declare at least one output.a – Name of the first input value to read from
ctx.b – Name of the second input value to read from
ctx.
- Throws:
-
void ComputeShapeAbs(ShapesContext &ctx, const NodeProto &node, const char *x)#
-
namespace math#
-
namespace shapes#
-
namespace onnx_optim