[ready] perf: no noop cast just to make mypy happy (#1626)

Co-authored-by: Roelof van Dijk <roelof.van.dijk@vitestro.com>
This commit is contained in:
Roelof van Dijk
2023-08-22 23:07:22 +02:00
committed by GitHub
parent f04a6d7882
commit 6fcfa50b35

View File

@@ -52,8 +52,7 @@ class Tensor:
# internal variables used for autograd graph construction
self._ctx: Optional[Function] = None
if data.__class__ is LazyBuffer:
data = cast(LazyBuffer, data) # NOTE: this is a noop, it makes mypy happy
if isinstance(data, LazyBuffer):
assert dtype is None or dtype == data.dtype, "dtype doesn't match, and casting isn't supported"
self.lazydata = data if data.device == device else LazyBuffer.loadop(LoadOps.FROM, data.shape, data.dtype, device, src=data)
return