docstr: A shape class that is used for setting multiple valid shape in InputType.
  
  shapes: list of Shape objects, or Shape-compatible lists.
      The valid shapes of the inputs.
      If input provided is not Shape object, but can be converted to Shape,
      the Shape object would be stored in `shapes` instead.
  default: tuple of int or None
      The default shape that is used for initiating the model, and set in
      the metadata of the model file.
      If None, then the first element in `shapes` would be used.
docstr_tok: ["A","shape","class","that","is","used","for","setting","multiple","valid","shape","in","InputType",".","shapes",":","list","of","Shape","objects",",","or","Shape-compatible","lists",".","The","valid","shapes","of","the","inputs",".","If","input","provided","is","not","Shape","object",",","but","can","be","converted","to","Shape",",","the","Shape","object","would","be","stored","in","`","shapes","`","instead",".","default",":","tuple","of","int","or","None","The","default","shape","that","is","used","for","initiating","the","model",",","and","set","in","the","metadata","of","the","model","file",".","If","None",",","then","the","first","element","in","`","shapes","`","would","be","used","."]
code: def __init__(self, shapes, default=None):
      """
      A shape class that is used for setting multiple valid shape in InputType.
  
      shapes: list of Shape objects, or Shape-compatible lists.
          The valid shapes of the inputs.
          If input provided is not Shape object, but can be converted to Shape,
          the Shape object would be stored in `shapes` instead.
      default: tuple of int or None
          The default shape that is used for initiating the model, and set in
          the metadata of the model file.
          If None, then the first element in `shapes` would be used.
      """
      from coremltools.converters.mil.mil import get_new_symbol
  
      if not isinstance(shapes, (list, tuple)):
          raise ValueError(
              "EnumeratedShapes should be list or tuple of shape, got type {} instead".format(
                  type(shapes)
              )
          )
      if len(shapes) < 2:
          raise ValueError(
              "EnumeratedShapes should be take a list or tuple with len >= 2, got {} instead".format(
                  len(shapes)
              )
          )
  
      self.shapes = []
      for idx, s in enumerate(shapes):
          if isinstance(s, Shape):
              self.shapes.append(s)
          else:
              self.shapes.append(Shape(s))
  
      self.symbolic_shape = self.shapes[0].symbolic_shape
      for shape in self.shapes:
          for idx, s in enumerate(shape.symbolic_shape):
              if is_symbolic(self.symbolic_shape[idx]):
                  continue
              elif is_symbolic(s):
                  self.symbolic_shape[idx] = s
              elif s != self.symbolic_shape[idx]:
                  self.symbolic_shape[idx] = get_new_symbol()
  
      if default is not None:
          if not isinstance(default, (list, tuple)):
              raise ValueError(
                  "Default shape should be list or tuple, got type {} instead".format(
                      type(default)
                  )
              )
          for idx, s in enumerate(default):
              if not isinstance(
                  s, (np.generic, six.integer_types)
              ) and not is_symbolic(s):
                  raise ValueError(
                      "Default shape invalid, got error at index {} which is {}".format(
                          idx, s
                      )
                  )
      else:
          default = self.shapes[0].default
      self.default = default
  
imports: import logging
  import numpy
  import six
  from coremltools.converters.mil.mil.types.symbolic import is_symbolic
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.types.type_mapping import numpy_type_to_builtin_type, is_builtin
label_desc: Use image node_id 1 to create a new EnumeratedShapes object from inherited base classes: object with example: obj = EnumeratedShapes(shapes, default)