MCPcopy Index your code
hub / github.com/pytorch/pytorch / _actual_loop

Method _actual_loop

caffe2/python/net_builder_test.py:124–143  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

122 return total, total_large, total_small, total_tiny
123
124 def _actual_loop(self):
125 total = ops.Const(0)
126 total_large = ops.Const(0)
127 total_small = ops.Const(0)
128 total_tiny = ops.Const(0)
129 with ops.loop(10) as loop:
130 outer = ops.Mul([loop.iter(), ops.Const(10)])
131 with ops.loop(loop.iter()) as inner:
132 val = ops.Add([outer, inner.iter()])
133 with ops.If(ops.GE([val, ops.Const(80)])) as c:
134 ops.Add([total_large, val], [total_large])
135 with c.Elif(ops.GE([val, ops.Const(50)])) as c:
136 ops.Add([total_small, val], [total_small])
137 with c.Else():
138 ops.Add([total_tiny, val], [total_tiny])
139 ops.Add([total, val], total)
140 return [
141 final_output(x)
142 for x in [total, total_large, total_small, total_tiny]
143 ]
144
145 def test_net_multi_use(self):
146 with Task() as task:

Callers 1

test_loopsMethod · 0.95

Calls 8

final_outputFunction · 0.90
ConstMethod · 0.80
IfMethod · 0.80
ElifMethod · 0.80
loopMethod · 0.45
iterMethod · 0.45
AddMethod · 0.45
ElseMethod · 0.45

Tested by

no test coverage detected