diff --git a/tinygrad/lazy.py b/tinygrad/lazy.py index 926ae191f2..99e34e5fda 100644 --- a/tinygrad/lazy.py +++ b/tinygrad/lazy.py @@ -70,6 +70,7 @@ class LazyBuffer: def cast(self, dtype:DType, bitcast:bool=False): if self.dtype == dtype: return self + if dtype.itemsize <= self.dtype.itemsize and self != self.base: return self.base.cast(dtype, bitcast)._view(self.st) return create_lazybuffer(self.device, ShapeTracker.from_shape(self.shape), dtype, UnaryOps.CAST, (dtype, bitcast), (self,)) def is_unrealized_const(self): return not self.base.realized and self.base.op is LoadOps.CONST