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

Class ExecutionStep

caffe2/python/core.py:2676–2865  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2674
2675
2676class ExecutionStep:
2677 _step_names_used = set()
2678
2679 @staticmethod
2680 def _get_next_step_name(basename):
2681 name = basename
2682 next_idx = 1
2683 while name in ExecutionStep._step_names_used:
2684 name = basename + '_' + str(next_idx)
2685 next_idx += 1
2686 ExecutionStep._step_names_used |= set([name])
2687 return name
2688
2689 def __init__(self, name, nets=None, num_iter=None):
2690 self._step = caffe2_pb2.ExecutionStep()
2691 self._step.name = name or ExecutionStep._get_next_step_name('step')
2692 self._net_dict = OrderedDict()
2693 self._is_used = False
2694 self._substeps = []
2695 if nets is not None:
2696 if type(nets) is Net:
2697 nets = [nets]
2698 for net in nets:
2699 if _add_net_to_dict(self._net_dict, net):
2700 self._step.network.extend([get_net_name(net)])
2701 if num_iter is not None:
2702 self._step.num_iter = num_iter
2703
2704 def get_net(self, name):
2705 return self._net_dict[name]
2706
2707 def Name(self):
2708 return self._step.name
2709
2710 def __str__(self):
2711 return self._step.name
2712
2713 def _assert_can_mutate(self):
2714 assert not self._is_used, (
2715 'Cannot mutate a step that has already been added to a plan/step.')
2716
2717 def _notify_is_used(self):
2718 self._is_used = True
2719
2720 def Proto(self):
2721 return self._step
2722
2723 def HasNets(self):
2724 return self._step.network is not None and (
2725 len(self._step.network) > 0)
2726
2727 def HasSubsteps(self):
2728 return self._step.substep is not None and (
2729 len(self._step.substep) > 0)
2730
2731 def Nets(self):
2732 return list(self._net_dict.values())
2733

Callers 1

execution_stepFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…