code: def test_multi_output_model(self, float32_two_output_model):
      # check that error is raised when only 1 output provided
      with pytest.raises(
          ValueError,
          match="please provide names for each of the outputs",
      ):
          mlmodel = ct.convert(
              float32_two_output_model,
              outputs=[ct.TensorType(dtype=np.float16)],
              minimum_deployment_target=ct.target.macOS13,
          )
  
      # check that error is raised when multiple outputs are provided without names
      with pytest.raises(
          ValueError,
          match="please provide names for each of the outputs",
      ):
          mlmodel = ct.convert(
              float32_two_output_model,
              outputs=[
                  ct.TensorType(dtype=np.float16),
                  ct.TensorType(dtype=np.float32),
              ],
              minimum_deployment_target=ct.target.macOS13,
          )
  
      # set 1 output to float16 and the other to float32
      output1_name = "Identity" if _HAS_TF_2 else "output1"
      output2_name = "Identity_1" if _HAS_TF_2 else "output2"
      mlmodel = ct.convert(
          float32_two_output_model,
          inputs=[ct.TensorType(dtype=np.float16)],
          outputs=[
              ct.TensorType(name=output2_name, dtype=np.float16),
              ct.TensorType(name=output1_name, dtype=np.float32),
          ],
          minimum_deployment_target=ct.target.macOS13,
      )
      assert_cast_ops_count(mlmodel, expected_count=1)
      assert_output_dtype(
          mlmodel,
          expected_type_str="fp16",
          expected_name=output2_name,
          index=0,
      )
      assert_output_dtype(
          mlmodel,
          expected_type_str="fp32",
          expected_name=output1_name,
          index=1,
      )
      assert_input_dtype(mlmodel, expected_type_str="fp16")
      verify_prediction(mlmodel)
  
      # in this case only the single output will be selected
      mlmodel = ct.convert(
          float32_two_output_model,
          inputs=[ct.TensorType(dtype=np.float16)],
          outputs=[ct.TensorType(name=output2_name, dtype=np.float16)],
          minimum_deployment_target=ct.target.macOS13,
      )
      assert_cast_ops_count(mlmodel, expected_count=0)
      assert_output_dtype(
          mlmodel,
          expected_type_str="fp16",
          expected_name=output2_name,
          index=0,
      )
      assert_input_dtype(mlmodel, expected_type_str="fp16")
      verify_prediction(mlmodel)
  
imports: import itertools
  import os
  import tempfile
  import numpy
  import pytest
  import coremltools
  from coremltools._deps import _HAS_TF_1, _HAS_TF_2, MSG_TF1_NOT_FOUND
  from coremltools.converters.mil.testing_reqs import backends, compute_units
  from coremltools.converters.mil.testing_utils import assert_cast_ops_count, assert_input_dtype, assert_ops_in_mil_program, assert_output_dtype, assert_prog_input_type, assert_prog_output_type, assert_spec_input_image_type, assert_spec_output_image_type, get_op_types_in_program, verify_prediction
  from coremltools.proto import FeatureTypes_pb2
  from coremltools.test.api.test_api_examples import TestInputs
label_desc: Use image node_id 12 for calling the TestInputOutputConversionAPI obj's underlying member method code with example usage: obj.test_multi_output_model(float32_two_output_model) without return types