code: def test_joint_export_to_caffe2(
      self,
      export_num_words,
      num_doc_classes,
      num_word_classes,
      test_num_words,
      num_predictions,
  ):
      config = self._get_config(IntentSlotTask.Config, JOINT_CONFIG)
      tensorizers, data = _NewTask._init_tensorizers(config)
      doc_labels = [SpecialTokens.UNK, "cu:other", "cu:address_Person"]
      word_labels = [
          SpecialTokens.PAD,
          SpecialTokens.UNK,
          "NoLabel",
          "person",
      ]
      tensorizers["word_labels"].vocab = Vocabulary(word_labels)
      tensorizers["doc_labels"].vocab = Vocabulary(doc_labels)
      tensorizers["tokens"].vocab = Vocabulary(WORD_VOCAB)
      py_model = _NewTask._init_model(config.model, tensorizers)
      dummy_test_input = self._get_rand_input_intent_slot(
          BATCH_SIZE, W_VOCAB_SIZE, test_num_words
      )
      exporter = ModelExporter(
          ModelExporter.Config(),
          py_model.get_export_input_names(tensorizers),
          dummy_test_input,
          py_model.vocab_to_export(tensorizers),
          py_model.get_export_output_names(tensorizers),
      )
  
      with tempfile.NamedTemporaryFile(
          delete=False, suffix=".{}".format(".predictor")
      ) as pred_file:
          exporter.export_to_caffe2(py_model, pred_file.name)
          workspace.ResetWorkspace()
  
      pred_net = pe.prepare_prediction_net(
          pred_file.name, CAFFE2_DB_TYPE
      )
  
      for _i in range(num_predictions):
          test_inputs = self._get_rand_input_intent_slot(
              BATCH_SIZE, W_VOCAB_SIZE, test_num_words
          )
          self._feed_c2_input(
              workspace,
              test_inputs,
              exporter.input_names,
              exporter.vocab_map,
          )
          workspace.RunNetOnce(pred_net)
          doc_output_names = [
              "{}:{}".format("doc_scores", class_name)
              for class_name in doc_labels
          ]
          word_output_names = [
              "{}:{}".format("word_scores", class_name)
              for class_name in word_labels
          ]
  
          py_model.eval()
          logits = py_model(*test_inputs)
          context = {"seq_lens": test_inputs[-1]}
          target = None
          (d_pred, w_pred), (d_score, w_score) = py_model.get_pred(
              logits, target, context
          )
  
          c2_doc_out = []
          for o_name in doc_output_names:
              c2_doc_out.extend(list(workspace.FetchBlob(o_name)))
          np.testing.assert_array_almost_equal(
              d_score.view(-1).detach().numpy(),
              np.array(c2_doc_out).flatten(),
          )
  
          c2_word_out = []
          for o_name in word_output_names:
              c2_word_out.extend(list(workspace.FetchBlob(o_name)))
  
          np.testing.assert_array_almost_equal(
              torch.transpose(w_score, 1, 2)
              .contiguous()
              .view(-1)
              .detach()
              .numpy(),
              np.array(c2_word_out).flatten(),
          )
  
imports: import json
  import operator
  import tempfile
  from collections import Counter
  from distutils.version import LooseVersion
  import caffe2.python.hypothesis_test_util
  import caffe2.python.predictor.predictor_exporter
  import hypothesis.strategies
  import numpy
  import torch
  import torch.nn.functional
  import torchtext
  from caffe2.python import workspace
  from hypothesis import given, settings
  from pytext.builtin_task import DocumentClassificationTask, IntentSlotTask, SeqNNTask, WordTaggingTask
  from pytext.common.constants import DatasetFieldName, SpecialTokens
  from pytext.config import config_from_json
  from pytext.config.component import create_exporter, create_model
  from pytext.data import CommonMetadata
  from pytext.data.utils import Vocabulary
  from pytext.exporters.exporter import ModelExporter
  from pytext.fields import CharFeatureField, DictFeatureField, FieldMeta, SeqFeatureField, TextFeatureField
  from pytext.legacy.vocab import Vocab
  from pytext.task.new_task import _NewTask
  from pytext.utils.onnx import CAFFE2_DB_TYPE
label_desc: Use image node_id 5 for calling the ModelExporterTest obj's underlying member method code with example usage: obj.test_joint_export_to_caffe2(export_num_words, num_doc_classes, num_word_classes, test_num_words, num_predictions) without return types