Skip to content

Commit d44e96b

Browse files
committed
Update on "Delegate Python ~ (invert operator) to Tensor.bitwise_not()."
Delegate Python ~ (invert operator) to Tensor.bitwise_not(). Close #20024, Close #22246, Close #22262 Related #22324 gh-metadata: pytorch pytorch 22326 gh/xuhdev/8/head
1 parent d9e6676 commit d44e96b

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

test/test_torch.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11230,10 +11230,6 @@ def test_bitwise_ops(self):
1123011230
else:
1123111231
self.assertFalse(x[idx] ^ y[idx])
1123211232

11233-
invert_result = ~x
11234-
for idx in iter_indices(x):
11235-
self.assertEqual(1 - x[idx], invert_result[idx])
11236-
1123711233
x_clone = x.clone()
1123811234
x_clone &= y
1123911235
self.assertEqual(x_clone, and_result)
@@ -11246,7 +11242,7 @@ def test_bitwise_ops(self):
1124611242
x_clone ^= y
1124711243
self.assertEqual(x_clone, xor_result)
1124811244

11249-
def test_invert(self):
11245+
def test_op_invert(self):
1125011246
for t in (torch.ByteTensor, torch.ShortTensor, torch.IntTensor, torch.LongTensor):
1125111247
a = torch.arange(127, dtype=t.dtype)
1125211248
self.assertEqual(~a, a.bitwise_not())

0 commit comments

Comments
 (0)