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 

Elementwise 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 base2. 

Multiplies 

Alias for 

Return the next floatingpoint value after 

Computes Python's modulus operation entrywise. 

Subtracts 

Alias for 

Alias for 

Computes elementwise equality 

Computes \(\text{input} \neq \text{other}\) elementwise. 

Computes \(\text{input} \leq \text{other}\) elementwise. 

Computes \(\text{input} \geq \text{other}\) elementwise. 

Alias for 

Alias for 

Computes \(\text{input} > \text{other}\) elementwise. 

Alias for 

Computes \(\text{input} < \text{other}\) elementwise. 

Alias for 

Computes the elementwise maximum of 

Computes the elementwise minimum of 

Computes the elementwise maximum of 

Computes the elementwise 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 base2. 



Computes the elementwise minimum of 

Computes the elementwise minimum of 

Computes the elementwise maximum of 
As always, if you have any feature requests, please file an issue on Github.