code: def test_compute_unit():
      # Case 1 - Inferring compute_unit
      m1 = TestMakePipeline._make_model(
          "x", 20, "y1", 10, compute_units=ct.ComputeUnit.CPU_ONLY
      )
      m2 = TestMakePipeline._make_model(
          "y1", 10, "y2", 2, compute_units=ct.ComputeUnit.CPU_ONLY
      )
      pipeline_model = ct.utils.make_pipeline(m1, m2)
      assert pipeline_model.compute_unit is ct.ComputeUnit.CPU_ONLY
  
      # Case 2 - Specifying compute_unit
      pipeline_model = ct.utils.make_pipeline(
          m1, m2, compute_units=ct.ComputeUnit.ALL
      )
      assert pipeline_model.compute_unit is ct.ComputeUnit.ALL
  
      # Case 3 (error case) - No compute_unit specified and the two models don't agree
      m2 = TestMakePipeline._make_model(
          "y1", 10, "y2", 2, compute_units=ct.ComputeUnit.ALL
      )
      with pytest.raises(
          ValueError,
          match='"compute_units" parameter must be specified.',
      ):
          pipeline_model = ct.utils.make_pipeline(m1, m2)
  
      # Case 4 (error case) - Garbage compute_unit input
      with pytest.raises(
          TypeError, match='"compute_units" parameter must'
      ):
          pipeline_model = ct.utils.make_pipeline(
              m1, m2, compute_units="Garbage!"
          )
  
imports: import itertools
  import tempfile
  import unittest
  import numpy
  import pytest
  import coremltools
  from coremltools._deps import _HAS_LIBSVM, _HAS_SKLEARN
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Function, Program
  from coremltools.models.pipeline import PipelineClassifier, PipelineRegressor
  from coremltools.models.utils import _is_macos
label_desc: Use image node_id 3 for calling the TestMakePipeline obj's underlying member method code with example usage: obj.test_compute_unit() without return types