code: def test_single_output_model(
      self, int32_input_model, float32_input_model_relu_ops
  ):
      # test output type
      mlmodel = ct.convert(
          int32_input_model, minimum_deployment_target=ct.target.macOS12
      )
      assert_ops_in_mil_program(mlmodel, expected_op_list=["add"])
      assert_output_dtype(mlmodel, expected_type_str="int32")
  
      # test that error is raised when an output of unknown name is provided
      with pytest.raises(Exception):
          # output name does not exist in the model
          mlmodel = ct.convert(
              int32_input_model,
              outputs=["z"],
              minimum_deployment_target=ct.target.macOS12,
          )
  
      # test that error is raised when two outputs are provided without names
      with pytest.raises(ValueError, match=", does not have names"):
          mlmodel = ct.convert(
              int32_input_model,
              outputs=[
                  ct.TensorType(dtype=np.float32),
                  ct.TensorType(dtype=np.float32),
              ],
              minimum_deployment_target=ct.target.macOS12,
          )
  
      # test that an error is raised when shape is provided for the output
      with pytest.raises(ValueError):
          mlmodel = ct.convert(
              int32_input_model,
              outputs=[ct.TensorType(dtype=np.float32, shape=(10, 20))],
              minimum_deployment_target=ct.target.macOS12,
          )
  
      # test that the output dtype provided by the user is applied during conversion
      mlmodel = ct.convert(
          int32_input_model,
          outputs=[ct.TensorType(dtype=np.float32)],
          minimum_deployment_target=ct.target.macOS12,
      )
      assert_output_dtype(
          mlmodel,
          expected_type_str="fp32",
          expected_name="Identity" if _HAS_TF_2 else "output",
      )
      assert_ops_in_mil_program(
          mlmodel, expected_op_list=["add", "cast"]
      )
  
      # test that output dtype of float16 is rejected when deployment target is low
      with pytest.raises(
          TypeError,
          match="float16 dtype for outputs is only supported for deployment target >= iOS16/macOS13",
      ):
          ct.convert(
              float32_input_model_relu_ops,
              outputs=[ct.TensorType(dtype=np.float16)],
              minimum_deployment_target=ct.target.macOS12,
          )
  
      # test that output type float16 is applied correctly
      mlmodel = ct.convert(
          float32_input_model_relu_ops,
          inputs=[ct.TensorType(name="input", dtype=np.float32)],
          outputs=[ct.TensorType(dtype=np.float16)],
          minimum_deployment_target=ct.target.macOS13,
      )
      assert_output_dtype(
          mlmodel,
          expected_type_str="fp16",
          expected_name="Identity" if _HAS_TF_2 else "output",
      )
      assert_ops_in_mil_program(
          mlmodel, expected_op_list=["cast", "relu"]
      )
  
      # test that input and output types float16 are applied correctly
      mlmodel = ct.convert(
          float32_input_model_relu_ops,
          inputs=[ct.TensorType(dtype=np.float16)],
          outputs=[ct.TensorType(dtype=np.float16)],
          minimum_deployment_target=ct.target.macOS13,
      )
      assert_input_dtype(mlmodel, expected_type_str="fp16")
      assert_output_dtype(
          mlmodel,
          expected_type_str="fp16",
          expected_name="Identity" if _HAS_TF_2 else "output",
      )
      assert_ops_in_mil_program(mlmodel, expected_op_list=["relu"])
      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 11 for calling the TestInputOutputConversionAPI obj's underlying member method code with example usage: obj.test_single_output_model(int32_input_model, float32_input_model_relu_ops) without return types