torch.bitwise_not
-
torch.bitwise_not(input, *, out=None) → Tensor
计算给定输入张量的按位非。输入张量必须是整数或布尔类型。对于布尔张量,它计算逻辑非。
- 参数:
input (Tensor) – 输入张量。
- 关键字参数:
输出(张量,可选)- 输出张量。
示例:
>>> torch.bitwise_not(torch.tensor([-1, -2, 3], dtype=torch.int8))
tensor([ 0, 1, -4], dtype=torch.int8)