code: def test_single_layer_example():
      batch_size, input_dim, output_dim = 2, 4, 2
  
      @mb.program(
          input_specs=[
              mb.TensorSpec(shape=(batch_size, input_dim)),
          ]
      )
      def prog(x):
          # Weight
          W_val = (
              np.array([0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
              .reshape(input_dim, output_dim)
              .T.astype(np.float32)
          )
          W = mb.const(val=W_val, mode="file_value", name="const_W")
  
          # bias
          b_val = np.array([-0.5, 0.5]).astype(np.float32)
          b = mb.const(val=b_val, mode="file_value", name="const_b")
  
          return mb.linear(x=x, weight=W, bias=b, name="lin")
  
      logging.info("prog:\n", prog)
  
      proto = converter._convert(
          prog, convert_from="mil", convert_to="nn_proto"
      )
  
      feed_dict = {
          "x": np.random.rand(batch_size, input_dim).astype(np.float32),
      }
      model = models.MLModel(proto)
      assert model is not None
  
      if ct.utils._is_macos():
          prediction = model.predict(feed_dict)
          assert len(prediction) == 1
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/mil/tests/test_programs.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import pytest
  import coremltools
  from coremltools import models
  import numpy
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil import converter
  import logging
label_desc: Use image node_id 1 for calling a global function with example usage: test_single_layer_example() and returns: mb