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
          is_optional = input_type.is_optional
          optional_value = input_type.optional_value
          shape = input_type.shape
          if not is_optional:
              continue
          msg = "Not support optional inputs for flexible input shape."
          if not isinstance(shape, Shape):
              raise NotImplementedError(msg)
          if any([isinstance(s, RangeDim) for s in shape.shape]):
              raise NotImplementedError(msg)
  
          default_map[input_type.name] = optional_value
  
      for idx, input in enumerate(proto.description.input):
          name = proto.description.input[idx].name
          if name in default_map:
              proto.description.input[idx].type.isOptional = True
              default_value = (
                  default_map[name]
                  if default_map[name] is not None
                  else 0.0
              )
              proto.description.input[
                  idx
              ].type.multiArrayType.floatDefaultValue = default_value
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import logging
  from collections import defaultdict
  from coremltools.converters.mil.input_types import ClassifierConfig, ImageType, EnumeratedShapes, Shape, RangeDim
  from coremltools.models import MLModel
  from coremltools.models import neural_network
  import coremltools.models.datatypes
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.types.symbolic import any_symbolic, any_variadic, is_symbolic
  from .op_mapping import convert_ops
  from coremltools.models.neural_network import flexible_shape_utils
  from coremltools.models.neural_network.flexible_shape_utils import update_image_size_range, add_enumerated_image_sizes, set_multiarray_ndshape_range, add_multiarray_ndshape_enumeration
  from .passes.nn_passes import nn_backend_passes
  from coremltools.converters._profile_utils import _profile
label_desc: Use image node_id 5 for calling a global function with example usage: _set_optional_inputs(proto, input_types) without return types