code: def test_onnx_to_caffe2_loop(self):
      body_nodes = [helper.make_node("MatMul", ["_X", "W"], ["_Y"])]
      nodes = self._make_fake_loop_op(
          body_nodes,
          [(TensorProto.FLOAT, (2, 2), "X")],
          [(TensorProto.FLOAT, (2, 2), "Y")],
      )
      X = np.random.rand(2, 2).astype(np.float32)
      W = np.random.rand(2, 2).flatten().astype(np.float32)
      graph_def = helper.make_graph(
          nodes,
          "test",
          [
              helper.make_tensor_value_info(
                  "X", TensorProto.FLOAT, (2, 2)
              ),
              helper.make_tensor_value_info(
                  "W", TensorProto.FLOAT, (2, 2)
              ),
          ],
          [
              helper.make_tensor_value_info(
                  "Y", TensorProto.FLOAT, (2, 2)
              )
          ],
          initializer=[
              helper.make_tensor(
                  "W", TensorProto.FLOAT, [2, 2], W.tolist()
              )
          ],
      )
      model_def = helper.make_model(
          graph_def, producer_name="onnx-to-caffe2-test"
      )
      Y = X
      for _ in range(10):
          Y = np.matmul(Y, W.reshape(2, 2))
      p = c2.prepare(model_def)
      out = p.run(X)
      np.testing.assert_allclose(out.Y, Y)
  
imports: import json
  import tempfile
  import textwrap
  import traceback
  import unittest
  import zipfile
  from caffe2.proto import caffe2_pb2
  from caffe2.python import brew, core
  from caffe2.python.model_helper import ModelHelper
  from click.testing import CliRunner
  import numpy
  from onnx import helper, ModelProto, TensorProto
  from caffe2.python.onnx.helper import c2_native_run_net
  from caffe2.python.onnx.bin.conversion import caffe2_to_onnx, onnx_to_caffe2
  import caffe2.python.onnx.backend
  from caffe2.python.onnx.tests.test_utils import TestCase
label_desc: Use image node_id 9 for calling the TestConversion obj's underlying member method code with example usage: obj.test_onnx_to_caffe2_loop() without return types