mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-25 14:58:46 -05:00
PoC UnaryOps before expand (#3319)
* PoC cast before expand * maybe also do unaryops before expand? * undo unaryops change
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user