diff --git a/tinygrad/uop/ops.py b/tinygrad/uop/ops.py index 5746412eb6..09dd9c9271 100644 --- a/tinygrad/uop/ops.py +++ b/tinygrad/uop/ops.py @@ -198,8 +198,6 @@ class UOpMetaClass(type): # NOTE: the key must separate nodes of different dtype: a CONST's dtype is the type of its arg, and True == 1 as dict keys if (wret:=UOpMetaClass.ucache.get(key:=(op, src, arg, tag, type(arg)), None)) is not None and (ret:=wret()) is not None: return ret UOpMetaClass.ucache[key] = weakref.ref(created:=super().__call__(op, src, arg, tag)) - # derive at construction: bottom up, so no recursion, and a bad node fails where it is built - created.__dict__["dtype"] = dtype_from_uop(op, src, arg) if metadata is not None: all_metadata[created] = metadata # NOTE: this value is set by pickle when pickling a realized tensor if _buffer is not None: @@ -243,7 +241,7 @@ class UOp(RandMixin, metaclass=UOpMetaClass): src:tuple[UOp, ...] = tuple() arg:Any = None tag:Any = None - @functools.cached_property + @recursive_property def dtype(self) -> DType: return dtype_from_uop(self.op, self.src, self.arg) def __del__(self): # NOTE: getattr because this object may be partially constructed (e.g. if __init__ raised, like the BEAM timeout SIGALRM)