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

Function build_pipeline

caffe2/python/checkpoint_test.py:25–40  ·  view source on GitHub ↗
(node_id)

Source from the content-addressed store, hash-verified

23
24
25def build_pipeline(node_id):
26 with Node('trainer_%d' % node_id):
27 with Job.current().init_group, Task():
28 data_arr = Struct(('val', np.array(list(range(10)))))
29 data = ConstRecord(ops, data_arr)
30 ds = Dataset(data, name='dataset:%d' % node_id)
31 full_reader = ds.reader(ops)
32 total = ops.Const([100])
33
34 def inc_total(rec):
35 ops.Add([total, rec.val()], [total])
36
37 epoch_reader = ReaderWithLimit(full_reader, num_iter=3)
38 pipe(epoch_reader, processor=inc_total)
39 Job.current().add_stop_condition(epoch_reader.data_finished())
40 return [total]
41
42
43EXPECTED_TOTALS = [103, 115, 136, 145]

Calls 14

readerMethod · 0.95
NodeClass · 0.90
TaskClass · 0.90
StructClass · 0.90
ConstRecordFunction · 0.90
DatasetClass · 0.90
ReaderWithLimitClass · 0.90
pipeFunction · 0.90
listFunction · 0.85
currentMethod · 0.80
ConstMethod · 0.80
add_stop_conditionMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…