mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-29 03:00:14 -04:00
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:
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user