MCPcopy
hub / github.com/tinygrad/tinygrad / _zero_kernel

Function _zero_kernel

tinygrad/nn/__init__.py:324–326  ·  view source on GitHub ↗
(out:UOp)

Source from the content-addressed store, hash-verified

322
323 # TODO: how do we remove this dumb kernel and use Tensor.zeros?
324 def _zero_kernel(out:UOp) -> UOp:
325 i = UOp.range(out.numel(), 0)
326 return out.flatten()[i].store(0).end(i).sink(arg=KernelInfo(name="zero"))
327 grad_weight_uop = grad_weight_uop.custom_kernel(fxn=_zero_kernel)[0]
328
329 # TODO: do we have a universal helper for this?

Callers

nothing calls this directly

Calls 7

KernelInfoClass · 0.90
numelMethod · 0.80
flattenMethod · 0.80
rangeMethod · 0.45
sinkMethod · 0.45
endMethod · 0.45
storeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…