MCPcopy
hub / github.com/tinygrad/tinygrad / addmul_kernel

Method addmul_kernel

test/unit/test_gradient.py:109–114  ·  view source on GitHub ↗
(C:UOp, D:UOp, A:UOp, B:UOp)

Source from the content-addressed store, hash-verified

107class TestMultiOutputGradient(unittest.TestCase):
108 @staticmethod
109 def addmul_kernel(C:UOp, D:UOp, A:UOp, B:UOp) -> UOp:
110 C, D, A, B = C.flatten(), D.flatten(), A.flatten(), B.flatten()
111 i = UOp.range(C.numel(), 0)
112 store_c = C[i].store(A[i] + B[i])
113 store_d = D[i].store(A[i] * B[i])
114 return UOp.group(store_c, store_d).end(i).sink(arg=KernelInfo(name="addmul")).simplify()
115 @staticmethod
116 def backward_addmul(grad_c, grad_d, call):
117 _c, _d, a, b = call.src[1:]

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected