mirror of https://github.com/commaai/tinygrad.git
perf: faster lazyop eq (#1693)
Co-authored-by: Roelof van Dijk <roelof.van.dijk@vitestro.com>
This commit is contained in:
parent
6ca509a485
commit
2730ed657f
|
@ -32,10 +32,7 @@ class LazyOp:
|
|||
except AttributeError: self.buffers = ()
|
||||
|
||||
def __repr__(self): return f"LazyOp(op={self.op}, src={self.src}, arg={self.arg})"
|
||||
def __eq__(self, __value: object) -> bool:
|
||||
if __value.__class__ is not LazyOp: return False
|
||||
__value = cast(LazyOp, __value)
|
||||
return self.op == __value.op and self.src == __value.src and self.arg == __value.arg
|
||||
def __eq__(self, __value: object) -> bool: return isinstance(__value, LazyOp) and self.op is __value.op and self.src == __value.src and self.arg == __value.arg
|
||||
def __hash__(self) -> int: return hash((self.op, self.src, self.arg))
|
||||
@property
|
||||
def key(self): return (self.op, tuple(map(lambda x: getattr(x, "key", x), self.src)), getattr(self.arg, "key", self.arg))
|
||||
|
|
Loading…
Reference in New Issue