mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-24 02:14:17 +00:00
delete test_variable_const [run_process_replay] (#6757)
* delete test_variable_const [run_process_replay] * don't allow variable UPat
This commit is contained in:
parent
0424c4967d
commit
ee4feedb77
2 changed files with 2 additions and 8 deletions
|
|
@ -388,11 +388,6 @@ class TestUOpStr(unittest.TestCase):
|
|||
sink = UOp(UOps.SINK, dtypes.void, (get_kernel(Device[Device.DEFAULT].renderer, t.schedule()[-1].ast).linearize().uops[-1],))
|
||||
assert_equiv_uops(sink, eval(str(sink)))
|
||||
|
||||
def test_variable_const(self):
|
||||
# TODO: this is not possible after VALID.
|
||||
uop = UOp(UOps.CONST, dtypes.int, (), arg=Variable("a",1,10))
|
||||
assert str(eval(str(uop))) == str(uop)
|
||||
|
||||
def test_vectorized_str(self):
|
||||
vec = UOp(UOps.VECTORIZE, dtypes.int.vec(4), tuple(UOp.const(dtypes.int, x) for x in range(4)))
|
||||
assert str(eval(str(vec))) == str(vec)
|
||||
|
|
|
|||
|
|
@ -169,8 +169,7 @@ class UOp(MathTrait):
|
|||
def key(self) -> bytes:
|
||||
return hashlib.sha256(str((self.op, self.dtype, self.arg)).encode() + b"".join([s.key for s in self.src])).digest()
|
||||
def __repr__(self): return pretty_print(self, lambda x: f"{type(self).__name__}({x.op}, {x.dtype}, arg={x.argstr()}, src=(%s))")
|
||||
def argstr(self):
|
||||
return f'({", ".join(map(str, self.arg))})' if self.op is UOps.REDUCE_AXIS else repr(self.arg) if isinstance(self.arg, Variable) else self.arg
|
||||
def argstr(self): return f'({", ".join(map(str, self.arg))})' if self.op is UOps.REDUCE_AXIS else self.arg
|
||||
# *** uop syntactic sugar
|
||||
@property
|
||||
def st_arg(self) -> ShapeTracker:
|
||||
|
|
@ -412,7 +411,7 @@ class UPat(MathTrait):
|
|||
return UPat((UOps.CONST, UOps.VCONST) if vec else UOps.CONST, dtype=dtype, name=name)
|
||||
@staticmethod
|
||||
@functools.lru_cache(None)
|
||||
def const(dtype:Optional[DType], b:ConstType|Variable): return UPat(UOps.CONST, dtype=dtype, arg=b)
|
||||
def const(dtype:Optional[DType], b:ConstType): return UPat(UOps.CONST, dtype=dtype, arg=b)
|
||||
|
||||
# copied from UOp
|
||||
def cast(self, dtype=None): return UPat(UOps.CAST, dtype, (self,))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue