diff --git a/tinygrad/ops.py b/tinygrad/ops.py index cf3dafca12..7adcdaa382 100644 --- a/tinygrad/ops.py +++ b/tinygrad/ops.py @@ -76,7 +76,7 @@ class UOp: def __lt__(self, x:UOp): return self.cmp_tuple < x.cmp_tuple @functools.cached_property def key(self) -> bytes: - return hashlib.sha256(functools.reduce(lambda x,y: x+y, [s.key for s in self.src], str((self.op, self.dtype, self.arg)).encode())).digest() + return hashlib.sha256(str((self.op, self.dtype, self.arg)).encode() + b"".join([s.key for s in self.src])).digest() def __repr__(self): return pretty_print(self, lambda x: f"{type(self).__name__}({x.op}, {x.dtype}, arg={x.argstr()}, src=(%s))") def argstr(self): return f'({", ".join(map(str, self.arg))})' if self.op is UOps.REDUCE_AXIS else repr(self.arg) if isinstance(self.arg, Variable) else self.arg