code: def test_rename_feature_mlprogram(self):
      @mb.program(input_specs=[mb.TensorSpec(shape=(3,))])
      def linear_prog(input):
          W = np.ones((10, 3), dtype=np.float32)
          out = mb.linear(x=input, weight=W, name="output")
          return out
  
      model = coremltools.convert(linear_prog, convert_to="mlprogram")
  
      spec = model.get_spec()
      input_name = spec.description.input[0].name
      output_name = spec.description.output[0].name
  
      # rename input
      rename_feature(spec, input_name, "new_input_name")
      self.assertEqual(spec.description.input[0].name, "new_input_name")
      model = coremltools.models.MLModel(
          spec, weights_dir=model.weights_dir
      )
      out = model.predict(
          {"new_input_name": np.array([1.0, 2.0, 3.0])}
      )[output_name]
      self.assertEqual(out.shape, (10,))
      self.assertEqual(out[0], 6.0)
  
      # rename output
      rename_feature(spec, output_name, "new_output_name")
      self.assertEqual(
          spec.description.output[0].name, "new_output_name"
      )
      model = coremltools.models.MLModel(
          spec, weights_dir=model.weights_dir
      )
      out = model.predict(
          {"new_input_name": np.array([1.0, 2.0, 3.0])}
      )["new_output_name"]
      self.assertEqual(out.shape, (10,))
      self.assertEqual(out[1], 6.0)
  
imports: import os
  import tempfile
  import unittest
  import numpy
  import PIL.Image
  import coremltools
  from coremltools import ComputeUnit
  from coremltools._deps import _HAS_TORCH
  from coremltools.converters.mil import Builder
  from coremltools.models import MLModel, datatypes
  from coremltools.models.neural_network import NeuralNetworkBuilder
  from coremltools.models.neural_network.utils import make_image_input, make_nn_classifier
  from coremltools.models.utils import _convert_neural_network_spec_weights_to_fp16, _is_macos, _macos_version, convert_double_to_float_multiarray_type, rename_feature, save_spec
  from coremltools.proto import Model_pb2
label_desc: Use image node_id 22 for calling the MLModelTest obj's underlying member method code with example usage: obj.test_rename_feature_mlprogram() and returns: out