MCPcopy
hub / github.com/tinygrad/tinygrad / test_zero_fold

Method test_zero_fold

test/backend/test_linearizer.py:198–204  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

196 assert any(x.op is Ops.PARAM for x in stores[1].toposort())
197
198 def test_zero_fold(self):
199 a, b = Tensor.randn(1).realize(), Tensor.randn(1).realize()
200 r = Tensor.stack(a, b)
201 uops = tuple(to_program(replace_opts(r.schedule_linear().src[-1].src[0], [Opt(op=OptOps.UPCAST, axis=0, arg=0)]),
202 renderer=Device[Device.DEFAULT].renderer).src[2].src)
203 num_ops = len([uop for uop in uops if uop.op in GroupOp.ALU])
204 assert num_ops == 0, "more alu uops than needed"
205
206 def test_sum_acc_dtype(self):
207 for tensor_dtype, acc_dtype in (

Callers

nothing calls this directly

Calls 7

to_programFunction · 0.90
replace_optsFunction · 0.90
OptClass · 0.90
realizeMethod · 0.80
randnMethod · 0.80
stackMethod · 0.80
schedule_linearMethod · 0.80

Tested by

no test coverage detected