shape_logical.h#
Shape-inference functions for ONNX operators in the logical family.
-
namespace ONNX_LIGHT_NAMESPACE
-
namespace onnx_optim
-
namespace shapes
-
namespace logical#
Functions
-
void ComputeShapeAnd(ShapesContext &ctx, const NodeProto &node, const char *a, const char *b)#
Computes the output :cpp:class:
OptimTensorof anAndnode and stores it inctx.Andis the logical, element-wise AND of two boolean operands with numpy-style multidirectional broadcasting (since opset 7; earlier revisions used an explicitbroadcastattribute but the shape propagation rules are identical when broadcasting is enabled, which onnx-light assumes). The output dtype is always :cpp:enumerator:TensorType::kBooland 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
AndNodeProtowhose output should be described.node.op_type()must be"And"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 ComputeShapeOr(ShapesContext &ctx, const NodeProto &node, const char *a, const char *b)#
Computes the output :cpp:class:
OptimTensorof anOrnode and stores it inctx.Oris the logical, element-wise OR of two boolean operands with numpy-style multidirectional broadcasting (since opset 7). The output dtype is always :cpp:enumerator:TensorType::kBooland 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
OrNodeProtowhose output should be described.node.op_type()must be"Or"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 ComputeShapeXor(ShapesContext &ctx, const NodeProto &node, const char *a, const char *b)#
Computes the output :cpp:class:
OptimTensorof aXornode and stores it inctx.Xoris the logical, element-wise XOR of two boolean operands with numpy-style multidirectional broadcasting (since opset 7). The output dtype is always :cpp:enumerator:TensorType::kBooland 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
XorNodeProtowhose output should be described.node.op_type()must be"Xor"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 ComputeShapeGreater(ShapesContext &ctx, const NodeProto &node, const char *a, const char *b)#
Computes the output :cpp:class:
OptimTensorof aGreaternode and stores it inctx.Greateris the element-wiseA > Bcomparison of two numeric operands with numpy-style multidirectional broadcasting (since opset 7; opset 1 only supported broadcasting via an explicitbroadcastattribute but the shape propagation rules are identical when broadcasting is enabled, which onnx-light assumes). The output dtype is always :cpp:enumerator:TensorType::kBooland 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
GreaterNodeProtowhose output should be described.node.op_type()must be"Greater"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 ComputeShapeLess(ShapesContext &ctx, const NodeProto &node, const char *a, const char *b)#
Computes the output :cpp:class:
OptimTensorof aLessnode and stores it inctx.Lessis the element-wiseA < Bcomparison of two numeric operands with numpy-style multidirectional broadcasting (since opset 7; opset 1 only supported broadcasting via an explicitbroadcastattribute but the shape propagation rules are identical when broadcasting is enabled, which onnx-light assumes). The output dtype is always :cpp:enumerator:TensorType::kBooland 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
LessNodeProtowhose output should be described.node.op_type()must be"Less"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 ComputeShapeAnd(ShapesContext &ctx, const NodeProto &node, const char *a, const char *b)#
-
namespace logical#
-
namespace shapes
-
namespace onnx_optim