code: def test_export_coreml(self):
      import coremltools
      import platform
  
      model = self.model
      for flexible_shape_on in [True, False]:
          filename = tempfile.NamedTemporaryFile(suffix=".mlmodel").name
          model.export_coreml(
              filename, include_flexible_shape=flexible_shape_on
          )
  
          ## Metadata test
          coreml_model = coremltools.models.MLModel(filename)
          metadata = coreml_model.user_defined_metadata
  
          self.assertEqual(
              metadata["com.github.apple.turicreate.version"],
              tc.__version__,
          )
          self.assertEqual(
              metadata["com.github.apple.os.platform"],
              platform.platform(),
          )
          self.assertEqual(metadata["type"], "style_transfer")
          self.assertEqual(metadata["version"], "1")
          self.assertEqual(
              metadata["content_feature"], self.content_feature
          )
          self.assertEqual(
              metadata["style_feature"], self.style_feature
          )
          self.assertEqual(metadata["model"], self.pre_trained_model)
          self.assertEqual(metadata["max_iterations"], "1")
          self.assertEqual(metadata["training_iterations"], "1")
          self.assertEqual(metadata["num_styles"], str(self.num_styles))
  
          expected_result = (
              "Style transfer created by Turi Create (version %s)"
              % (tc.__version__)
          )
          self.assertEquals(
              expected_result, coreml_model.short_description
          )
  
          ## Correctness test
          if not flexible_shape_on or _mac_ver() >= (10, 14):
              coreml_model = coremltools.models.MLModel(filename)
  
              mac_os_version_threshold = (
                  (10, 14) if flexible_shape_on else (10, 13)
              )
              if _mac_ver() >= mac_os_version_threshold:
                  img = self.style_sf[0:2][self.style_feature][0]
                  img_fixed = tc.image_analysis.resize(img, 256, 256, 3)
                  img = self._coreml_python_predict(
                      coreml_model, img_fixed
                  )
                  self.assertEqual(img.shape, (256, 256, 3))
  
                  if flexible_shape_on:
                      # Test for flexible shape
                      img = self.style_sf[0:2][self.style_feature][1]
                      img_fixed = tc.image_analysis.resize(
                          img, 512, 512, 3
                      )
                      img = self._coreml_python_predict(
                          coreml_model, img_fixed
                      )
                      self.assertEqual(img.shape, (512, 512, 3))
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import unittest
  import pytest
  from .None import util
  import turicreate
  import tempfile
  import numpy
  import platform
  import sys
  import os
  from turicreate.toolkits._main import ToolkitError
  from turicreate.toolkits._internal_utils import _raise_error_if_not_sframe, _mac_ver
label_desc: Use image node_id 22 for calling the StyleTransferTest obj's underlying member method code with example usage: obj.test_export_coreml() without return types