code: def test_ios17_mixed_precision(
      self, compute_unit, backend, x_dtype, y_dtype
  ):
      x_val = np.random.randint(low=0, high=10, size=(2, 5)).astype(
          x_dtype
      )
      y_val = np.random.randint(low=0, high=10, size=(5, 10)).astype(
          y_dtype
      )
      x_mb_dtype = numpy_type_to_builtin_type(x_dtype)
      y_mb_dtype = numpy_type_to_builtin_type(y_dtype)
      expected_outputs = np.matmul(x_val, y_val)
  
      def build_x_const(y):
          return mb.matmul(
              x=x_val, y=y, transpose_x=False, transpose_y=False
          )
  
      def build_y_const(x):
          return mb.matmul(
              x=x, y=y_val, transpose_x=False, transpose_y=False
          )
  
      mlmodel = run_compare_builder(
          build_y_const,
          input_placeholders={
              "x": mb.placeholder(shape=x_val.shape, dtype=x_mb_dtype)
          },
          input_values={"x": x_val},
          expected_output_types=expected_outputs.shape + (x_mb_dtype,),
          expected_outputs=expected_outputs,
          compute_unit=compute_unit,
          backend=backend,
          pass_pipeline=ct.PassPipeline.EMPTY,
      )
      prog = mlmodel._mil_program
      matmul_op = prog["main"].find_ops(op_type="matmul")[0]
      # When x is non-const and y is const, the output should have the same dtype as x.
      assert types.builtin_to_string(
          matmul_op.outputs[0].dtype
      ) == types.builtin_to_string(x_mb_dtype)
  
      mlmodel = run_compare_builder(
          build_x_const,
          input_placeholders={
              "y": mb.placeholder(shape=y_val.shape, dtype=y_mb_dtype)
          },
          input_values={"y": y_val},
          expected_output_types=expected_outputs.shape + (y_mb_dtype,),
          expected_outputs=expected_outputs,
          compute_unit=compute_unit,
          backend=backend,
          pass_pipeline=ct.PassPipeline.EMPTY,
      )
      prog = mlmodel._mil_program
      matmul_op = prog["main"].find_ops(op_type="matmul")[0]
      # When x is const and y is non-const, the output should have the same dtype as y.
      assert types.builtin_to_string(
          matmul_op.outputs[0].dtype
      ) == types.builtin_to_string(y_mb_dtype)
  
file_path: coremltools/coremltools/converters/mil/mil/ops/tests/iOS17/test_linear.py
imports: import itertools
  import numpy
  import pytest
  import coremltools
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.ops.tests.iOS17 import backends
  from coremltools.converters.mil.mil.ops.tests.testing_utils import run_compare_builder
  from coremltools.converters.mil.mil.types import builtin_to_string, nptype_from_builtin
  from coremltools.converters.mil.mil.types.type_mapping import numpy_type_to_builtin_type
  from coremltools.converters.mil.testing_reqs import compute_units
label_desc: Use image node_id 1 for calling the TestMatMul obj's underlying member method code with example usage: obj.test_ios17_mixed_precision(compute_unit, backend, x_dtype, y_dtype) and returns: mb, mb