remove const_arg (#9002)

* remove const_arg

* use -m pytest

* remove test_const_arg test, variable arg on CONST does not exist.

* use base in test_const_dtype
This commit is contained in:
qazal
2025-02-10 12:45:11 +01:00
committed by GitHub
parent 0568720a68
commit b17ec42b56
5 changed files with 7 additions and 22 deletions

View File

@@ -61,12 +61,12 @@ class TestTensorUOp(unittest.TestCase):
def test_const_dtype(self):
lb: UOp = Tensor([1], dtype=dtypes.int).lazydata
assert lb.const_like(1).const_arg == 1
assert type(lb.const_like(1).const_arg) is int
assert lb.const_like(1).base.arg == 1
assert type(lb.const_like(1).base.arg) is int
lb: UOp = Tensor([1], dtype=dtypes.float).lazydata
assert lb.const_like(1).const_arg == 1.0
assert type(lb.const_like(1).const_arg) is float
assert lb.const_like(1).base.arg == 1.0
assert type(lb.const_like(1).base.arg) is float
def test_contiguous_alu(self):
a = Tensor.randn(2, 2).realize()

View File

@@ -418,14 +418,6 @@ class TestUOpMethod(unittest.TestCase):
self.assertEqual(const._device, None)
with self.assertRaises(AssertionError): const.device
def test_const_arg(self):
var = UOp.variable("a", 1, 10)
with self.assertRaises(AssertionError): UOp.const(dtypes.int, var).const_arg
const = UOp.const(dtypes.int, 1)
self.assertEqual(const.const_arg, 1)
tensor_const = UOp.metaop(Ops.CONST, (), dtypes.int, Device.DEFAULT, 1)
self.assertEqual(tensor_const.const_arg, 1)
class TestUOpStr(unittest.TestCase):
def test_uop_str(self):
a = UOp(Ops.CONST, dtypes.float, (), 2.0) + UOp(Ops.CONST, dtypes.float, (), 3.0)