The binary primitive computes an operation between source 0 and source 1 element-wise (the variable names follow the standard Naming Conventions):
\[ \dst(\overline{x}) = \src_0(\overline{x}) \mathbin{op} \src_1(\overline{x}), \]
where \(op\) is addition, multiplication, get maximum value or get minimum value.
The binary primitive does not have a notion of forward or backward propagations.
When executed, the inputs and outputs should be mapped to an execution argument index as specified by the following table.
Primitive input/output | Execution argument index |
---|---|
\(\src_0\) | DNNL_ARG_SRC_0 |
\(\src_1\) | DNNL_ARG_SRC_1 |
\(\dst\) | DNNL_ARG_DST |
The following attributes are supported:
Type | Operation | Description | Res |
---|---|---|---|
Attribute | Scales | Scales the corresponding input tensor by the given scale factor(s). | The corresponding tensor has integer data type. Only one scale per tensor is supported. Input tensors only. |
Post-op | Sum | Adds the operation result to the destination tensor instead of overwriting it. | Must precede eltwise post-op. |
Post-op | Eltwise | Applies an Eltwise operation to the result. |
The source and destination tensors may have f32
, bf16
, or int8
data types. See Data Types page for more details.
The binary primitive works with arbitrary data tensors. There is no special meaning associated with any of tensors dimensions.