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

Function execution_step

caffe2/python/core.py:2974–3037  ·  view source on GitHub ↗

Helper for creating an ExecutionStep. - steps_or_nets can be: - None - Net - ExecutionStep - list - list - should_stop_blob is either None or a scalar boolean blob. - This blob is checked AFTER every substeps/subnets. - If sp

(default_name,
                   steps_or_nets,
                   num_iter=None,
                   report_net=None,
                   report_interval=None,
                   concurrent_substeps=None,
                   should_stop_blob=None,
                   only_once=None,
                   num_concurrent_instances=None,
                   create_workspace=False,
                   run_every_ms=None)

Source from the content-addressed store, hash-verified

2972
2973
2974def execution_step(default_name,
2975 steps_or_nets,
2976 num_iter=None,
2977 report_net=None,
2978 report_interval=None,
2979 concurrent_substeps=None,
2980 should_stop_blob=None,
2981 only_once=None,
2982 num_concurrent_instances=None,
2983 create_workspace=False,
2984 run_every_ms=None):
2985 """
2986 Helper for creating an ExecutionStep.
2987 - steps_or_nets can be:
2988 - None
2989 - Net
2990 - ExecutionStep
2991 - list<Net>
2992 - list<ExecutionStep>
2993 - should_stop_blob is either None or a scalar boolean blob.
2994 - This blob is checked AFTER every substeps/subnets.
2995 - If specified and true, then this step will return immediately.
2996 - Be sure to handle race conditions if setting from concurrent threads.
2997 - if no should_stop_blob or num_iter is provided, defaults to num_iter=1
2998 """
2999 assert should_stop_blob is None or num_iter is None, (
3000 'Cannot set both should_stop_blob and num_iter.')
3001 if should_stop_blob is None and num_iter is None:
3002 num_iter = 1
3003
3004 step = ExecutionStep(default_name)
3005 if should_stop_blob is not None:
3006 step.SetShouldStopBlob(should_stop_blob)
3007 if num_iter is not None:
3008 step.SetIter(num_iter)
3009 if only_once is not None:
3010 step.SetOnlyOnce(only_once)
3011 if concurrent_substeps is not None:
3012 step.SetConcurrentSubsteps(concurrent_substeps)
3013 if report_net is not None:
3014 assert report_interval is not None
3015 step.SetReportNet(report_net, report_interval)
3016 if num_concurrent_instances is not None:
3017 step.SetNumConcurrentInstances(num_concurrent_instances)
3018 if create_workspace:
3019 step.SetCreateWorkspace(True)
3020 if run_every_ms:
3021 step.RunEveryMillis(run_every_ms)
3022
3023 if isinstance(steps_or_nets, ExecutionStep):
3024 step.AddSubstep(steps_or_nets)
3025 elif isinstance(steps_or_nets, Net):
3026 step.AddNet(steps_or_nets)
3027 elif isinstance(steps_or_nets, list):
3028 if all(isinstance(x, Net) for x in steps_or_nets):
3029 for x in steps_or_nets:
3030 step.AddNet(x)
3031 else:

Callers 3

create_from_protoMethod · 0.85
to_execution_stepFunction · 0.85
scoped_execution_stepFunction · 0.85

Calls 14

SetShouldStopBlobMethod · 0.95
SetIterMethod · 0.95
SetOnlyOnceMethod · 0.95
SetConcurrentSubstepsMethod · 0.95
SetReportNetMethod · 0.95
SetCreateWorkspaceMethod · 0.95
RunEveryMillisMethod · 0.95
AddSubstepMethod · 0.95
AddNetMethod · 0.95
ExecutionStepClass · 0.85
isinstanceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…