code: def get_numericalize_net(
      init_net, predict_net, vocab_map, input_names
  ):
      init_net = core.Net(init_net)
      final_input_names = input_names.copy()
  
      create_context(init_net)
      vocab_indices = create_vocab_indices_map(init_net, vocab_map)
  
      final_predict_net = core.Net(predict_net.name + "_processed")
      final_inputs = set(
          {
              ext_input
              for ext_input in input_names
              if ext_input not in vocab_map.keys()
          }
      )
  
      for ext_input in final_inputs:
          final_predict_net.AddExternalInput(ext_input)
  
      # add external_input and external_output from init_net
      init_net_proto = init_net.Proto()
      items = set(
          {
              item
              for item in itertools.chain(
                  init_net_proto.external_input,
                  init_net_proto.external_output,
              )
          }
      )
      for item in items:
          final_predict_net.AddExternalInput(item)
  
      for feat in vocab_map.keys():
          raw_input_blob = final_predict_net.AddExternalInput(
              convert_caffe2_blob_name(feat)
          )
          flattened_input_blob = final_predict_net.FlattenToVec(
              raw_input_blob
          )
          flattened_ids = final_predict_net.IndexGet(
              [vocab_indices[feat], flattened_input_blob]
          )
          final_predict_net.ResizeLike(
              [flattened_ids, raw_input_blob], [feat]
          )
          final_input_names[
              input_names.index(feat)
          ] = convert_caffe2_blob_name(feat)
  
      return (init_net, final_predict_net, final_input_names)
  
file_path: pytext/pytext/utils/mobile_onnx.py
imports: import itertools
  import numpy
  import onnx
  import torch
  from caffe2.python import core, utils, workspace
  from caffe2.python.onnx import backend
  from pytext.utils.onnx import convert_caffe2_blob_name
label_desc: Use image node_id 4 for calling a global function with example usage: get_numericalize_net(init_net, predict_net, vocab_map, input_names) and returns: init_net,  final_predict_net,  final_input_names