fix neg logical_not inconsistencies (#3222)

* try

* test: add logical_not tests

* gah im retarded, but this doesn't match types for const()

* fix: can't we jsut do this?

* big change: I don't actually know what I'm doing

* WOOO IM JUST CHANGING EVERYTHING WOW probably gon revert later

* BYE BYE noqa: E501

* fix: less lines and add test

* fix: rm 2 redundant tests

* fix: eq with False so we don't unintentionally implicit upcast, but it's bool anyways so w/e
This commit is contained in:
geohotstan
2024-01-25 00:48:40 +08:00
committed by GitHub
parent e2e4632aea
commit 842053873d
9 changed files with 14 additions and 12 deletions

View File

@@ -290,8 +290,11 @@ class TestOps(unittest.TestCase):
helper_test_op([()], lambda x: 2-x)
def test_neg(self):
helper_test_op([(45,65)], lambda x: -x)
helper_test_op([()], lambda x: -x)
helper_test_op([(45,65)], lambda x: x.neg())
helper_test_op([()], lambda x: x.neg())
def test_logical_not(self):
helper_test_op(None, torch.logical_not, Tensor.logical_not, vals=[[True, False, True]], forward_only=True)
helper_test_op(None, torch.logical_not, Tensor.logical_not, vals=[[1.,2.,0.,0.5]], forward_only=True)
def test_mul(self):
helper_test_op([(64,64), (64,64)], lambda x,y: x*y, Tensor.mul)