code: def test_extract_submodel_mlprogram(
      self, compute_unit, store_to_disk
  ):
      prog = get_simple_program()
      model = ct.convert(
          prog,
          convert_to="mlprogram",
          compute_units=compute_unit,
          compute_precision=ct.precision.FLOAT32,
      )
  
      if store_to_disk:
          model_dir = tempfile.TemporaryDirectory()
          mlmodel_path = os.path.join(model_dir.name, "model.mlpackage")
          model.save(mlmodel_path)
          model = ct.models.MLModel(
              mlmodel_path, compute_units=compute_unit
          )
  
      submodel = extract_submodel(
          model, outputs=["output_0", "output_1"]
      )
  
      # check that the submodel retains the same backend
      assert submodel.get_spec().WhichOneof("Type") == "mlProgram"
  
      # check that the submodel retains the same compute unit
      assert submodel.compute_unit == compute_unit
  
      # check the subgraph
      assert get_op_types_in_program(submodel._mil_program) == [
          "add",
          "transpose",
          "square",
          "tanh",
      ]
  
      # check the numerical outputs
      coreml_in = np.random.rand(1, 2, 3, 4)
      coreml_out = submodel.predict({"x": coreml_in})
      gt = compute_ground_truth_answer(coreml_in)
      assert len(coreml_out) == len(gt)
      for k, v in gt.items():
          np.testing.assert_allclose(v, coreml_out[k], atol=0.2)
  
file_path: coremltools/coremltools/converters/mil/mil/tests/test_debug.py
imports: import itertools
  import os
  import tempfile
  import pytest
  import numpy
  import coremltools
  from coremltools.converters.mil import Builder
  from coremltools.converters.mil.debugging_utils import extract_submodel
  from coremltools.converters.mil.mil import get_new_symbol
  from coremltools.converters.mil.mil.types.symbolic import is_symbolic
  from coremltools.converters.mil.testing_utils import get_op_types_in_program
label_desc: Use image node_id 5 for calling the TestExtractSubModel obj's underlying member method code with example usage: obj.test_extract_submodel_mlprogram(compute_unit, store_to_disk) without return types