docstr: When x and y are both const or both non-const, mixed precision is not allowed.
docstr_tok: ["When","x","and","y","are","both","const","or","both","non-const",",","mixed","precision","is","not","allowed","."]
code: def test_ios17_invalid_mixed_precision(self, compute_unit, backend):
      """When x and y are both const or both non-const, mixed precision is not allowed."""
      x_val = np.random.rand(2, 5).astype(np.float32)
      y_val = np.random.randint(low=0, high=10, size=(5, 10)).astype(
          np.int32
      )
  
      def build_both_const():
          return mb.matmul(
              x=x_val, y=y_val, transpose_x=False, transpose_y=False
          )
  
      def build_both_not_const(x, y):
          return mb.matmul(
              x=x, y=y, transpose_x=False, transpose_y=False
          )
  
      with pytest.raises(
          ValueError,
          match="when x and y are both const, their dtype need to match",
      ):
          run_compare_builder(
              build_both_const,
              input_placeholders={},
              input_values={},
              compute_unit=compute_unit,
              backend=backend,
          )
  
      with pytest.raises(
          ValueError,
          match="when x and y are both non-const, their dtype need to match",
      ):
          run_compare_builder(
              build_both_not_const,
              input_placeholders={
                  "x": mb.placeholder(
                      shape=x_val.shape, dtype=types.fp32
                  ),
                  "y": mb.placeholder(
                      shape=y_val.shape, dtype=types.int32
                  ),
              },
              input_values={"x": x_val, "y": y_val},
              compute_unit=compute_unit,
              backend=backend,
          )
  
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 2 for calling the TestMatMul obj's underlying member method code with example usage: obj.test_ios17_invalid_mixed_precision(compute_unit, backend) and returns: mb, mb