code: def test_downgrade_specification_version(self):
      # manually set a invalid specification version
      self.spec.specificationVersion = -1
      model = MLModel(self.spec)
      assert model.get_spec().specificationVersion == 1
  
      # manually set a high specification version
      self.spec.specificationVersion = 4
      filename = tempfile.mktemp(suffix=".mlmodel")
      save_spec(
          self.spec, filename, auto_set_specification_version=True
      )
      model = MLModel(filename)
      assert model.get_spec().specificationVersion == 1
  
      # simple neural network with only spec 1 layer
      input_features = [("data", datatypes.Array(3))]
      output_features = [("out", datatypes.Array(3))]
      builder = NeuralNetworkBuilder(input_features, output_features)
      builder.add_activation("relu", "RELU", "data", "out")
      # set a high specification version
      builder.spec.specificationVersion = 3
      model = MLModel(builder.spec)
      filename = tempfile.mktemp(suffix=".mlmodel")
      model.save(filename)
      # load the model back
      model = MLModel(filename)
      assert model.get_spec().specificationVersion == 1
  
      # test save without automatic set specification version
      self.spec.specificationVersion = 3
      filename = tempfile.mktemp(suffix=".mlmodel")
      save_spec(
          self.spec, filename, auto_set_specification_version=False
      )
      model = MLModel(filename)
      # the specification version should be original
      assert model.get_spec().specificationVersion == 3
  
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 13 for calling the MLModelTest obj's underlying member method code with example usage: obj.test_downgrade_specification_version() without return types