Binary Operations
As you may have seen in the tutorial, MaskedTensor
also has binary operations implemented with the caveat
that the masks in two masked tensors must match or else an error will be raised. As noted in the error, if you
need support for a particular operator or have proposed semantics for how they should be behave instead, please open
an issue on Github. For now, we have decided to go with the most conservative implementation to ensure that users
know exactly what is going on and are being intentional about their decisions with masked semantics.
The available binary operators are:
|
Adds |
|
Element-wise arctangent of \(\text{input}_{i} / \text{other}_{i}\) with consideration of the quadrant. |
|
Alias for |
|
Computes the bitwise AND of |
|
Computes the bitwise OR of |
|
Computes the bitwise XOR of |
|
Computes the left arithmetic shift of |
|
Computes the right arithmetic shift of |
|
Divides each element of the input |
|
Alias for |
|
|
|
Applies C++'s std::fmod entrywise. |
|
Logarithm of the sum of exponentiations of the inputs. |
|
Logarithm of the sum of exponentiations of the inputs in base-2. |
|
Multiplies |
|
Alias for |
|
Return the next floating-point value after |
|
Computes Python's modulus operation entrywise. |
|
Subtracts |
|
Alias for |
|
Alias for |
|
Computes element-wise equality |
|
Computes \(\text{input} \neq \text{other}\) element-wise. |
|
Computes \(\text{input} \leq \text{other}\) element-wise. |
|
Computes \(\text{input} \geq \text{other}\) element-wise. |
|
Alias for |
|
Alias for |
|
Computes \(\text{input} > \text{other}\) element-wise. |
|
Alias for |
|
Computes \(\text{input} < \text{other}\) element-wise. |
|
Alias for |
|
Computes the element-wise maximum of |
|
Computes the element-wise minimum of |
|
Computes the element-wise maximum of |
|
Computes the element-wise minimum of |
|
Alias for |
The available inplace binary operators are all of the above except:
|
Logarithm of the sum of exponentiations of the inputs. |
|
Logarithm of the sum of exponentiations of the inputs in base-2. |
|
|
|
Computes the element-wise minimum of |
|
Computes the element-wise minimum of |
|
Computes the element-wise maximum of |
As always, if you have any feature requests, please file an issue on Github.