MCPcopy
hub / github.com/tinygrad/tinygrad / custom_eye_kernel

Function custom_eye_kernel

test/backend/test_custom_kernel.py:12–15  ·  view source on GitHub ↗
(C:UOp)

Source from the content-addressed store, hash-verified

10 return C[i].store(i.cast(C.dtype.base)).end(i).sink(arg=KernelInfo(name=f"custom_arange_{C.shape[0]}"))
11
12def custom_eye_kernel(C:UOp) -> UOp:
13 i = UOp.range(C.shape[0], 0)
14 j = UOp.range(C.shape[1], 1)
15 return C[i, j].store((i.eq(j)).cast(C.dtype.base)).end(i, j).sink(arg=KernelInfo(name=f"custom_eye_{C.numel()}"))
16
17def custom_add_one_kernel(B:UOp, A:UOp) -> UOp:
18 A,B = A.flatten(), B.flatten()

Callers

nothing calls this directly

Calls 8

KernelInfoClass · 0.90
eqMethod · 0.80
numelMethod · 0.80
rangeMethod · 0.45
sinkMethod · 0.45
endMethod · 0.45
storeMethod · 0.45
castMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…