class_docstr: Exporter for converting models to their caffe2 init and predict nets.
  Does not rely on c2_prepared, but rather splits the ONNX model into
  the init and predict nets directly.
class_docstr_tok: ["Exporter","for","converting","models","to","their","caffe2","init","and","predict","nets",".","Does","not","rely","on","c2_prepared",",","but","rather","splits","the","ONNX","model","into","the","init","and","predict","nets","directly","."]
code: def export_to_caffe2(
      self, model, export_path: str, export_onnx_path: str = None
  ) -> List[str]:
      init_net_path, predict_net_path = self.get_export_paths(
          export_path
      )
      print(f"Saving caffe2 init net to {init_net_path}")
      print(f"Saving caffe2 init net to {predict_net_path}")
  
      init_net, predict_net = mobile_onnx.pytorch_to_caffe2(
          model,
          self.dummy_model_input,
          self.input_names,
          self.output_names,
          export_path,
          export_onnx_path,
      )
  
      # prepend operators
      init_net, predict_net, final_input_names = self.prepend_operators(
          init_net, predict_net, self.input_names
      )
      init_net = core.Net(init_net)
      predict_net = core.Net(predict_net)
  
      # postprocess input
      mobile_onnx.create_context(init_net)
      net_outputs, final_out_names = self.postprocess_output(
          init_net, predict_net, workspace, self.output_names, model
      )
      for output in net_outputs:
          predict_net.AddExternalOutput(output)
  
      # convert nets to proto
      init_net = init_net.Proto()
      predict_net = predict_net.Proto()
  
      # save proto files
      save_caffe2_pb_net(init_net_path, init_net)
      save_caffe2_pb_net(predict_net_path, predict_net)
  
imports: import os
  from typing import Dict, List
  from caffe2.python import core, workspace
  from pytext.config import ConfigBase
  from pytext.config.field_config import FeatureConfig, FloatVectorConfig
  from pytext.config.module_config import ExporterType
  from pytext.exporters.exporter import ModelExporter
  from pytext.fields import FieldMeta
  from pytext.utils import mobile_onnx
  from pytext.utils.file_io import PathManager
label_desc: Use image node_id 4 for calling the InitPredictNetExporter obj's underlying member method code with example usage: obj.export_to_caffe2(model, export_path, export_onnx_path) without return types