class_docstr: A visitor to traverse subgraphs and build Core ML models.
docstr: Build a Core ML model and compile it with Xcode toolchain.
docstr_tok: ["Build","a","Core","ML","model","and","compile","it","with","Xcode","toolchain","."]
code: def compile(self, out_dir):
      """
      Build a Core ML model and compile it with Xcode toolchain.
      """
      import coremltools
      from coremltools.proto.Model_pb2 import ArrayFeatureType
  
      FEATURE_TYPE_MAP = {
          "float32": ArrayFeatureType.FLOAT32,
          "float64": ArrayFeatureType.DOUBLE,
          "int32": ArrayFeatureType.INT32,
      }
  
      input_names, input_dims, input_dtypes = zip(*self.model_inputs_)
      self.builder.set_input(input_names, input_dims)
      for i, dtype in enumerate(input_dtypes):
          assert dtype in FEATURE_TYPE_MAP
          input_desc = self.builder.spec.description.input
          input_desc[i].type.multiArrayType.dataType = FEATURE_TYPE_MAP[
              dtype
          ]
  
      output_dim = [int(n) for n in self.function.ret_type.shape]
      self.builder.set_output(
          self.out_map[self.function.body], [output_dim]
      )
      for i, dtype in enumerate([self.function.ret_type.dtype]):
          assert dtype in FEATURE_TYPE_MAP
          output_desc = self.builder.spec.description.output
          output_desc[
              i
          ].type.multiArrayType.dataType = FEATURE_TYPE_MAP[dtype]
  
      model = coremltools.models.MLModel(self.builder.spec)
      xcode.compile_coreml(model, self.model_name, out_dir)
  
imports: import os
  import shutil
  import tvm._ffi
  from ...relay.expr_functor import ExprVisitor
  from ..None import xcode, coreml_runtime
label_desc: Use image node_id 5 for calling the CodegenCoreML obj's underlying member method code with example usage: obj.compile(out_dir) without return types