Sub - version 7#
This page documents version 7 of operator Sub. See Sub for the latest version (since version 14).
Domain:
ai.onnxSince version: 7
Performs element-wise binary subtraction (with Numpy-style broadcasting support).
This operator supports multidirectional (i.e., Numpy-style) broadcasting; for more details please check the broadcasting behavior in ONNX.
Inputs
A (T): First operand.
B (T): Second operand.
Outputs
C (T): Result, has same element type as two inputs
Type Constraints
T: Constrain input and output types to high-precision numeric tensors. Allowed types: tensor(double), tensor(float), tensor(float16), tensor(int32), tensor(int64), tensor(uint32), tensor(uint64).
Differences with previous version (6)#
SchemaDiff: Sub (domain 'ai.onnx')
old version: 6
new version: 7
breaking: no
Documentation:
line similarity: 0.09 (+3/-18 lines)
--- Sub v6
+++ Sub v7
@@ -1,19 +1,4 @@
-Performs element-wise binary subtraction (with limited broadcast support).
-If necessary the right-hand-side argument will be broadcasted to match the
-shape of left-hand-side argument. When broadcasting is specified, the second
-tensor can either be of element size 1 (including a scalar tensor and any
-tensor with rank equal to or smaller than the first tensor), or having its
-shape as a contiguous subset of the first tensor's shape. The starting of the
-mutually equal shape is specified by the argument "axis", and if it is not set,
-suffix matching is assumed. 1-dim expansion doesn't work yet.
+Performs element-wise binary subtraction (with Numpy-style broadcasting support).
-For example, the following tensor shapes are supported (with broadcast=1):
-
- shape(A) = (2, 3, 4, 5), shape(B) = (,), i.e. B is a scalar tensor
- shape(A) = (2, 3, 4, 5), shape(B) = (1, 1), i.e. B is an 1-element tensor
- shape(A) = (2, 3, 4, 5), shape(B) = (5,)
- shape(A) = (2, 3, 4, 5), shape(B) = (4, 5)
- shape(A) = (2, 3, 4, 5), shape(B) = (3, 4), with axis=1
- shape(A) = (2, 3, 4, 5), shape(B) = (2), with axis=0
-
-Attribute `broadcast=1` needs to be passed to enable broadcasting.
+This operator supports multidirectional (i.e., Numpy-style) broadcasting;
+for more details please check the broadcasting behavior in ONNX.