TensorDictBase.__xor__#
- TensorDictBase.__xor__(other: Any) Self | bool#
Computes
self ^ otherleaf by leaf and returns a new tensordict.The operation is a logical XOR for boolean leaves and a bitwise XOR for integer leaves.
otheris paired as in__eq__(): a tensordict ordictmust have the same keys, or aKeyErroris raised. Anotherof another type, such asNoneor a string, givesTrueand aFutureWarning. Starting with TensorDict 0.17, the default will change to returningNotImplemented, so that Python raises aTypeError, as it does for tensors and for&.The result is a new tensordict that is not locked and, except with a tensor
otherof one or more dims, has no dim names.&,~and the arithmetic operators keep the dim names and the lock.- Parameters:
other (TensorDictBase, dict, Tensor or Number) – the other operand.
Every tensordict class and every tensorclass has this method. For the other methods, see Methods by task.