code: def test_ios17_different_dtypes(
      self, compute_unit, backend, x_dtype, k_dtype
  ):
      def build(x):
          return mb.topk(x=x, k=k_dtype(2), axis=1)
  
      val = np.array([[2, 3, 1], [5, 4, 6]], dtype=x_dtype)
      x_mb_dtype = types.numpy_type_to_builtin_type(x_dtype)
      input_placeholders = {
          "x": mb.placeholder(shape=val.shape, dtype=x_mb_dtype)
      }
      input_values = {"x": val}
      # As int16 is not in CoreML I/O supported dtypes, it will be cast to int32.
      expected_output_types = [(2, 2, x_mb_dtype), (2, 2, types.int32)]
      expected_outputs = [
          np.array([[3, 2], [6, 5]], dtype=x_dtype),
          np.array([[1, 0], [2, 0]], dtype=np.int32),
      ]
  
      mlmodel = run_compare_builder(
          build,
          input_placeholders,
          input_values,
          expected_output_types,
          expected_outputs,
          compute_unit=compute_unit,
          backend=backend,
      )
      prog = mlmodel._mil_program
      topk_op = prog["main"].find_ops(op_type="topk")[0]
      expected_x_dtype = x_mb_dtype
      if backend.precision == "fp16" and types.is_float(x_mb_dtype):
          expected_x_dtype = types.fp16
      assert types.builtin_to_string(
          topk_op.x.dtype
      ) == types.builtin_to_string(expected_x_dtype)
  
file_path: coremltools/coremltools/converters/mil/mil/ops/tests/iOS17/test_tensor_operation.py
imports: import itertools
  import numpy
  import pytest
  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.testing_reqs import compute_units
label_desc: Use image node_id 1 for calling the TestTopK obj's underlying member method code with example usage: obj.test_ios17_different_dtypes(compute_unit, backend, x_dtype, k_dtype) and returns: mb