mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-06 21:53:53 -05:00
one less branch in Buffer.view [pr] (#13829)
This commit is contained in:
@@ -199,8 +199,7 @@ class Buffer:
|
||||
return mv
|
||||
def view(self, size:int, dtype:DType, offset:int) -> Buffer:
|
||||
assert offset < self.nbytes, "offset must be less than nbytes"
|
||||
if self._base is not None: return Buffer(self.device, size, dtype, base=self._base, offset=self.offset+offset)
|
||||
return Buffer(self.device, size, dtype, base=self, offset=offset)
|
||||
return Buffer(self.device, size, dtype, base=self.base, offset=self.offset+offset)
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class DMACPURef:
|
||||
|
||||
Reference in New Issue
Block a user