MCPcopy
hub / github.com/tinygrad/tinygrad / fxn

Method fxn

test/null/test_pattern_matcher.py:37–41  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

35 def test_match_sz_0(self):
36 match_cnt = 0
37 def fxn(x):
38 nonlocal match_cnt
39 match_cnt += 1
40 assert len(x.src) == 0
41 return UOp(Ops.CONST, src=(UOp(Ops.CONST),))
42 matcher = PatternMatcher([(UPat(Ops.CONST, src=(), name="x"), fxn)])
43 c1 = UOp(Ops.CONST, dtypes.float, arg=1.0)
44 # second rewrite shouldn't match anything

Callers

nothing calls this directly

Calls 3

UOpClass · 0.90
appendMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected