Create ExecutionStep from ExecutionStep protobuf recursively
(cls, step_proto, net_obj_dict, net_proto_dict)
| 2815 | |
| 2816 | @classmethod |
| 2817 | def create_from_proto(cls, step_proto, net_obj_dict, net_proto_dict): |
| 2818 | """ |
| 2819 | Create ExecutionStep from ExecutionStep protobuf recursively |
| 2820 | """ |
| 2821 | assert isinstance(step_proto, caffe2_pb2.ExecutionStep) |
| 2822 | assert (len(step_proto.network) > 0 and len(step_proto.substep) == 0) or \ |
| 2823 | (len(step_proto.network) == 0 and len(step_proto.substep) > 0) |
| 2824 | |
| 2825 | steps_or_nets = [] |
| 2826 | if len(step_proto.substep) > 0: |
| 2827 | for substep_proto in step_proto.substep: |
| 2828 | steps_or_nets.append(ExecutionStep.create_from_proto( |
| 2829 | substep_proto, net_obj_dict, net_proto_dict)) |
| 2830 | else: |
| 2831 | for net_name in step_proto.network: |
| 2832 | if net_name not in net_obj_dict: |
| 2833 | assert net_name in net_proto_dict |
| 2834 | net = Net(net_proto_dict[net_name]) |
| 2835 | net_obj_dict[net_name] = net |
| 2836 | net = net_obj_dict[net_name] |
| 2837 | assert isinstance(net, Net) |
| 2838 | steps_or_nets.append(net) |
| 2839 | |
| 2840 | num_iter = step_proto.num_iter if step_proto.HasField('num_iter') else None |
| 2841 | concurrent_substeps = step_proto.concurrent_substeps if\ |
| 2842 | step_proto.HasField('concurrent_substeps') else None |
| 2843 | should_stop_blob = BlobReference(step_proto.should_stop_blob) if\ |
| 2844 | step_proto.HasField('should_stop_blob') else None |
| 2845 | only_once = step_proto.only_once if\ |
| 2846 | step_proto.HasField('only_once') else None |
| 2847 | num_concurrent_instances = step_proto.num_concurrent_instances if\ |
| 2848 | step_proto.HasField('num_concurrent_instances') else None |
| 2849 | create_workspace = step_proto.create_workspace if\ |
| 2850 | step_proto.HasField('create_workspace') else None |
| 2851 | run_every_ms = step_proto.run_every_ms if\ |
| 2852 | step_proto.HasField('run_every_ms') else None |
| 2853 | |
| 2854 | return execution_step( |
| 2855 | step_proto.name, |
| 2856 | steps_or_nets, |
| 2857 | num_iter=num_iter, |
| 2858 | report_net=None, # DEPRECATED |
| 2859 | report_interval=None, # DEPRECATED |
| 2860 | concurrent_substeps=concurrent_substeps, |
| 2861 | should_stop_blob=should_stop_blob, |
| 2862 | only_once=only_once, |
| 2863 | num_concurrent_instances=num_concurrent_instances, |
| 2864 | create_workspace=create_workspace, |
| 2865 | run_every_ms=run_every_ms) |
| 2866 | |
| 2867 | |
| 2868 | def add_nets_in_order(step, net_list): |
nothing calls this directly
no test coverage detected