MCPcopy
hub / github.com/tinygrad/tinygrad / replace

Method replace

tinygrad/uop/ops.py:142–147  ·  view source on GitHub ↗
(self, **kwargs)

Source from the content-addressed store, hash-verified

140 if self.op is Ops.BUFFER and self.realized is not None: args.append(self.realized)
141 return UOp, tuple(args)
142 def replace(self, **kwargs) -> UOp:
143 new_args = (kwargs.pop("op", self.op), kwargs.pop("dtype", self.dtype), kwargs.pop("src", self.src),
144 kwargs.pop("arg", self.arg), kwargs.pop("tag", self.tag))
145 assert len(kwargs) == 0, f"unused kwargs in replace {list(kwargs)}"
146 if (self.op, self.dtype, self.src, self.arg, self.tag) == new_args: return self
147 return UOp(*new_args)
148 def rtag(self, tag=True): return self.replace(tag=tag)
149 @recursive_property
150 def key(self) -> bytes:

Callers 15

rtagMethod · 0.95
do_to_programFunction · 0.95
test_replaceMethod · 0.95
gen_statsFunction · 0.45
tag_uopFunction · 0.45
callify.pyFile · 0.45
finalize_afterFunction · 0.45
function.pyFile · 0.45
_serialize_codeFunction · 0.45
_compact_paramsFunction · 0.45
compute_gradientFunction · 0.45
mainFunction · 0.45

Calls 1

UOpClass · 0.85

Tested by 15

test_replaceMethod · 0.76
ioctls_from_headerFunction · 0.36
test_mnistMethod · 0.36
test_mnist_backwardMethod · 0.36
count_3Method · 0.36
test_inf_loopMethod · 0.36
root_rewriteFunction · 0.36
test_inc_by_oneMethod · 0.36
fxnMethod · 0.36
test_tagged_replaceMethod · 0.36
test_inf_loopMethod · 0.36