MCPcopy Create free account
hub / github.com/pytorch/pytorch / analyze_step

Function analyze_step

caffe2/python/net_printer.py:97–118  ·  view source on GitHub ↗
(analyzer, step)

Source from the content-addressed store, hash-verified

95
96@Analyzer.register(ExecutionStep)
97def analyze_step(analyzer, step):
98 proto = step.Proto()
99 with analyzer.set_workspace(do_copy=proto.create_workspace):
100 if proto.report_net:
101 with analyzer.set_workspace(do_copy=True):
102 analyzer(step.get_net(proto.report_net))
103 all_new_blobs = set()
104 substeps = step.Substeps() + [step.get_net(n) for n in proto.network]
105 for substep in substeps:
106 with analyzer.set_workspace(
107 do_copy=proto.concurrent_substeps) as ws_in:
108 analyzer(substep)
109 if proto.should_stop_blob:
110 analyzer.need_blob(proto.should_stop_blob)
111 if proto.concurrent_substeps:
112 new_blobs = set(ws_in.keys()) - set(analyzer.workspace.keys())
113 assert len(all_new_blobs & new_blobs) == 0, (
114 'Error: Blobs created by multiple parallel steps: %s' % (
115 ', '.join(all_new_blobs & new_blobs)))
116 all_new_blobs |= new_blobs
117 for x in all_new_blobs:
118 analyzer.define_blob(x)
119
120
121@Analyzer.register(Task)

Callers

nothing calls this directly

Calls 8

set_workspaceMethod · 0.80
get_netMethod · 0.80
SubstepsMethod · 0.80
need_blobMethod · 0.80
define_blobMethod · 0.80
ProtoMethod · 0.45
keysMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…