From 6fcfa50b351e80f942f946329ab862edb7f7e3da Mon Sep 17 00:00:00 2001 From: Roelof van Dijk <3604013+roelofvandijk@users.noreply.github.com> Date: Tue, 22 Aug 2023 23:07:22 +0200 Subject: [PATCH] [ready] perf: no noop cast just to make mypy happy (#1626) Co-authored-by: Roelof van Dijk --- tinygrad/tensor.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tinygrad/tensor.py b/tinygrad/tensor.py index 60d78374ed..c7ced60a37 100644 --- a/tinygrad/tensor.py +++ b/tinygrad/tensor.py @@ -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