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

Method proc

caffe2/python/dataio_test.py:158–180  ·  view source on GitHub ↗
(rec)

Source from the content-addressed store, hash-verified

156 totals = [None] * 3
157
158 def proc(rec):
159 # executed once
160 with ops.task_init():
161 counter1 = ops.CreateCounter([], ['global_counter'])
162 counter2 = ops.CreateCounter([], ['global_counter2'])
163 counter3 = ops.CreateCounter([], ['global_counter3'])
164 # executed once per thread
165 with ops.task_instance_init():
166 task_counter = ops.CreateCounter([], ['task_counter'])
167 # executed on each iteration
168 ops.CountUp(counter1)
169 ops.CountUp(task_counter)
170 # executed once per thread
171 with ops.task_instance_exit():
172 with ops.loop(ops.RetrieveCount(task_counter)):
173 ops.CountUp(counter2)
174 ops.CountUp(counter3)
175 # executed once
176 with ops.task_exit():
177 totals[0] = final_output(ops.RetrieveCount(counter1))
178 totals[1] = final_output(ops.RetrieveCount(counter2))
179 totals[2] = final_output(ops.RetrieveCount(counter3))
180 return rec
181
182 # Read full data set from original reader
183 with TaskGroup() as tg:

Callers

nothing calls this directly

Calls 6

final_outputFunction · 0.90
task_initMethod · 0.80
task_instance_initMethod · 0.80
task_instance_exitMethod · 0.80
task_exitMethod · 0.80
loopMethod · 0.45

Tested by

no test coverage detected