code: def _set_optional_inputs(proto, input_types):
      # Set default values for optional input_types
      default_map = {}
      for input_type in input_types:
          if isinstance(input_type, ImageType):
              continue
          if input_type.default_value is not None:
              default_map[input_type.name] = input_type.default_value
  
      for idx, input in enumerate(proto.description.input):
          name = proto.description.input[idx].name
          if name in default_map:
              default_value = default_map[name]
              proto.description.input[idx].type.isOptional = True
              array_t = proto.description.input[idx].type.multiArrayType
              default_fill_val = default_value.flatten()[0]
              array_t.floatDefaultValue = default_fill_val
              if (
                  default_fill_val != 0
                  or list(default_value.shape) != array_t.shape
              ):
                  # promote spec version to 5 and set the default value
                  proto.specificationVersion = max(
                      proto.specificationVersion,
                      ct._SPECIFICATION_VERSION_IOS_14,
                  )
                  # array_t.shape is not empty.
                  array_t.ClearField("shape")
                  array_t.shape.extend(list(default_value.shape))
  
file_path: coremltools/coremltools/converters/mil/backend/nn/load.py
imports: import coremltools
  from coremltools.converters._profile_utils import _profile
  from coremltools.converters.mil.backend.backend_helper import _get_probability_var_for_classifier
  from coremltools.converters.mil.input_types import ColorLayout, EnumeratedShapes, ImageType, RangeDim, Shape
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.types.symbolic import any_symbolic, any_variadic, is_symbolic
  from coremltools.models import MLModel
  from coremltools.models import neural_network
  from coremltools.models.datatypes import Array
  from coremltools.models.neural_network import flexible_shape_utils
  from coremltools.models.neural_network.flexible_shape_utils import add_enumerated_image_sizes, add_multiarray_ndshape_enumeration, set_multiarray_ndshape_range
  from ..backend_helper import _get_colorspace_enum, _validate_image_input_output_shapes
  from .op_mapping import convert_ops
label_desc: Use image node_id 5 for calling a global function with example usage: _set_optional_inputs(proto, input_types) without return types