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

Function print_step

caffe2/python/net_printer.py:341–367  ·  view source on GitHub ↗
(text, step)

Source from the content-addressed store, hash-verified

339
340@Printer.register(ExecutionStep)
341def print_step(text, step):
342 proto = step.Proto()
343 step_ctx, do_substep = _get_step_context(step)
344 with text.context(step_ctx):
345 if proto.report_net:
346 with text.context(call('report_net', [proto.report_interval])):
347 text(step.get_net(proto.report_net))
348 substeps = step.Substeps() + [step.get_net(n) for n in proto.network]
349 for substep in substeps:
350 sub_proto = (
351 substep.Proto() if isinstance(substep, ExecutionStep) else None)
352 if sub_proto is not None and sub_proto.run_every_ms:
353 substep_ctx = call(
354 'reporter',
355 [str(substep), ('interval_ms', sub_proto.run_every_ms)])
356 elif do_substep:
357 title = (
358 'workspace'
359 if sub_proto is not None and sub_proto.create_workspace else
360 'step')
361 substep_ctx = call(title, [str(substep)])
362 else:
363 substep_ctx = None
364 with text.context(substep_ctx):
365 text(substep)
366 if proto.should_stop_blob:
367 text.add(call('yield stop_if', [proto.should_stop_blob]))
368
369
370def _print_task_output(x):

Callers

nothing calls this directly

Calls 9

_get_step_contextFunction · 0.85
callFunction · 0.85
textFunction · 0.85
isinstanceFunction · 0.85
get_netMethod · 0.80
SubstepsMethod · 0.80
ProtoMethod · 0.45
contextMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…