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

Method get_step

caffe2/python/task.py:585–630  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

583 self._step = core.to_execution_step(step)
584
585 def get_step(self):
586 if self._step_with_setup is not None:
587 return self._step_with_setup
588
589 if self._step is None:
590 self._step_with_setup = core.execution_step(self.name, [])
591 return self._step_with_setup
592
593 report_steps = [
594 s
595 for s in self._step.get_all_attributes(Task.REPORT_STEP)
596 if not hasattr(s, '_report_step_used')
597 ]
598 for step in report_steps:
599 step._report_step_used = True
600 if not step.Proto().run_every_ms:
601 step.RunEveryMillis(1000)
602 task_init_nets, task_exit_nets = get_setup_nets(
603 Task.TASK_SETUP, [self._step] + report_steps, self)
604 instance_init_nets, instance_exit_nets = get_setup_nets(
605 Task.TASK_INSTANCE_SETUP, [self._step] + report_steps, self)
606 if len(self._outputs) == 0:
607 output_net = core.Net('%s:output' % self.name)
608 self.add_output(output_net.ConstantFill(
609 [], 1, dtype=core.DataType.INT32, value=0))
610 task_exit_nets.append(output_net)
611
612 # Add instance-level report steps
613 body = self._step if not report_steps else core.execution_step(
614 '%s:body' % self.name, report_steps + [self._step])
615 # Enclose with instance-level (thread-local) setup nets
616 step_with_instance_setup = add_setup_steps(
617 body, instance_init_nets, instance_exit_nets,
618 self.name + ':instance')
619 # Set up runtime concurrent instances
620 if self._num_instances and self._num_instances > 1:
621 step_with_instance_setup.SetCreateWorkspace(True)
622 step_with_instance_setup = core.execution_step(
623 '%s:parallel',
624 [step_with_instance_setup],
625 num_concurrent_instances=self._num_instances)
626 # Enclose with task-level setup nets
627 self._step_with_setup = add_setup_steps(
628 step_with_instance_setup, task_init_nets, task_exit_nets, self.name)
629
630 return self._step_with_setup
631
632 def output_list(self):
633 return TaskOutputList(self._outputs)

Callers 7

_notify_usedMethod · 0.95
tasks_by_nodeMethod · 0.80
build_cache_stepMethod · 0.80
analyze_taskFunction · 0.80
print_taskFunction · 0.80
_compile_task_groupMethod · 0.80

Calls 10

add_outputMethod · 0.95
get_setup_netsFunction · 0.85
add_setup_stepsFunction · 0.85
execution_stepMethod · 0.80
RunEveryMillisMethod · 0.80
NetMethod · 0.80
SetCreateWorkspaceMethod · 0.80
get_all_attributesMethod · 0.45
ProtoMethod · 0.45
appendMethod · 0.45

Tested by 1