code: def test_iO16_default_fp16_multiple_output(
      self,
      float32_two_output_model,
      int32_two_output_model,
      int32_float32_two_output_model,
  ):
      output1_name = "Identity" if _HAS_TF_2 else "output1"
      output2_name = "Identity_1" if _HAS_TF_2 else "output2"
  
      # Case 1: fp32 two outputs model. First output dtype missing
      mlmodel = ct.convert(
          float32_two_output_model,
          outputs=[
              ct.TensorType(name=output1_name),
              ct.TensorType(name=output2_name, dtype=np.float32),
          ],
          minimum_deployment_target=ct.target.iOS16,
      )
      assert_output_dtype(mlmodel, expected_type_str="fp16", index=0)
      assert_output_dtype(mlmodel, expected_type_str="fp32", index=1)
      verify_prediction(mlmodel)
  
      # Case 2: fp32 two outputs model. Second output dtype missing
      mlmodel = ct.convert(
          float32_two_output_model,
          outputs=[
              ct.TensorType(name=output1_name, dtype=np.int32),
              ct.TensorType(name=output2_name),
          ],
          minimum_deployment_target=ct.target.iOS16,
      )
      assert_output_dtype(mlmodel, expected_type_str="int32", index=0)
      assert_output_dtype(mlmodel, expected_type_str="fp16", index=1)
      verify_prediction(mlmodel)
  
      # Case 3: fp32 two outputs model. Both output dtype missing
      mlmodel = ct.convert(
          float32_two_output_model,
          outputs=[
              ct.TensorType(name=output1_name),
              ct.TensorType(name=output2_name),
          ],
          minimum_deployment_target=ct.target.iOS16,
      )
      assert_output_dtype(mlmodel, expected_type_str="fp16", index=0)
      assert_output_dtype(mlmodel, expected_type_str="fp16", index=1)
      verify_prediction(mlmodel)
  
      # Case 4: fp32 two outputs model. outputs not set.
      mlmodel = ct.convert(
          float32_two_output_model,
          minimum_deployment_target=ct.target.iOS16,
      )
      assert_output_dtype(mlmodel, expected_type_str="fp16", index=0)
      assert_output_dtype(mlmodel, expected_type_str="fp16", index=1)
      verify_prediction(mlmodel)
  
      # Case 5: int32 two outputs model. outputs not set. No change happens.
      mlmodel = ct.convert(
          int32_two_output_model,
          minimum_deployment_target=ct.target.iOS16,
      )
      assert_output_dtype(mlmodel, expected_type_str="int32", index=0)
      assert_output_dtype(mlmodel, expected_type_str="int32", index=1)
      verify_prediction(mlmodel)
  
      # Case 6: int32 two outputs model. The first input is force set to fp32.
      # In this case, the first output is inferred as fp32 as well, so it defaults
      # to fp16.
      mlmodel = ct.convert(
          int32_two_output_model,
          inputs=[
              ct.TensorType(name="input1", dtype=np.float32),
              ct.TensorType(name="input2"),
          ],
          minimum_deployment_target=ct.target.iOS16,
      )
      assert_output_dtype(mlmodel, expected_type_str="fp16", index=0)
      assert_output_dtype(mlmodel, expected_type_str="int32", index=1)
      verify_prediction(mlmodel)
  
      # Case 7: int32 two outputs model. The second input is force set to fp16.
      # In this case, the second output is inferred as fp32 as well, so it defaults
      # to fp16.
      mlmodel = ct.convert(
          int32_two_output_model,
          inputs=[
              ct.TensorType(name="input1"),
              ct.TensorType(name="input2", dtype=np.float16),
          ],
          minimum_deployment_target=ct.target.iOS16,
      )
      assert_output_dtype(mlmodel, expected_type_str="int32", index=0)
      assert_output_dtype(mlmodel, expected_type_str="fp16", index=1)
      verify_prediction(mlmodel)
  
      # Case 8: two outputs model with int32/fp32.
      # In this case, the fp32 output defaults to fp16, while the int32 one remains unchanged.
      mlmodel = ct.convert(
          int32_float32_two_output_model,
          minimum_deployment_target=ct.target.iOS16,
      )
      assert_output_dtype(mlmodel, expected_type_str="fp16", index=0)
      assert_output_dtype(mlmodel, expected_type_str="int32", index=1)
      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 4 for calling the TestiOS16DefaultIODtype obj's underlying member method code with example usage: obj.test_iO16_default_fp16_multiple_output(float32_two_output_model, int32_two_output_model, int32_float32_two_output_model) without return types