docstr: Configuration class used for image inputs in Core ML.
  
  Parameters
  ----------
  scale: float or list of floats
      The scaling factor for all values in the image channels.
  
  bias: float or list of floats
      * If ``color_layout`` is ``ct.colorlayout.GRAYSCALE`` or
        ``ct.colorlayout.GRAYSCALE_FLOAT16``, bias would be a ``float``.
      * If ``color_layout`` is ``ct.colorlayout.RGB`` or ``ct.colorlayout.BGR``,
        bias would be a list of ``float``.
  
  color_layout: string or enumeration of type ``ct.colorlayout``
      Color layout of the image. Valid values are as follows:
  
      Enumeration (recommended):
          * ``ct.colorlayout.RGB``
          * ``ct.colorlayout.BGR``
          * ``ct.colorlayout.GRAYSCALE``
          * ``ct.colorlayout.GRAYSCALE_FLOAT16``
  
      String values (older way to specify):
          * ``'G'``: Grayscale (maps to ``ct.colorlayout.GRAYSCALE``)
          * ``'RGB'``: [Red, Green, Blue] (maps to ``ct.colorlayout.BGR``)
          * ``'BGR'``: [Blue, Green, Red] (maps to ``ct.colorlayout.RGB``)
  
  channel_first: (bool) or None
      Set to ``True`` if input format is channel first.
  
      Default format:
          * For TensorFlow: channel last (``channel_first=False``).
          * For PyTorch: channel first (``channel_first=True``).
docstr_tok: ["Configuration","class","used","for","image","inputs","in","Core","ML",".","Parameters","--","--","--","--","--","scale",":","float","or","list","of","floats","The","scaling","factor","for","all","values","in","the","image","channels",".","bias",":","float","or","list","of","floats","*","If","``","color_layout","``","is","``","ct.colorlayout.GRAYSCALE","``","or","``","ct.colorlayout.GRAYSCALE_FLOAT16","``",",","bias","would","be","a","``","float","``",".","*","If","``","color_layout","``","is","``","ct.colorlayout.RGB","``","or","``","ct.colorlayout.BGR","``",",","bias","would","be","a","list","of","``","float","``",".","color_layout",":","string","or","enumeration","of","type","``","ct.colorlayout","``","Color","layout","of","the","image",".","Valid","values","are","as","follows",":","Enumeration","(","recommended",")",":","*","``","ct.colorlayout.RGB","``","*","``","ct.colorlayout.BGR","``","*","``","ct.colorlayout.GRAYSCALE","``","*","``","ct.colorlayout.GRAYSCALE_FLOAT16","``","String","values","(","older","way","to","specify",")",":","*","``","'","G","'","``",":","Grayscale","(","maps","to","``","ct.colorlayout.GRAYSCALE","``",")","*","``","'RGB","'","``",":","[","Red",",","Green",",","Blue","]","(","maps","to","``","ct.colorlayout.BGR","``",")","*","``","'BGR","'","``",":","[","Blue",",","Green",",","Red","]","(","maps","to","``","ct.colorlayout.RGB","``",")","channel_first",":","(","bool",")","or","None","Set","to","``","True","``","if","input","format","is","channel","first",".","Default","format",":","*","For","TensorFlow",":","channel","last","(","``","channel_first=False","``",")",".","*","For","PyTorch",":","channel","first","(","``","channel_first=True","``",")","."]
code: def __init__(
      self,
      name=None,
      shape=None,
      scale=1.0,
      bias=None,
      color_layout=ColorLayout.RGB,
      channel_first=None,
  ):
      """
      Configuration class used for image inputs in Core ML.
  
      Parameters
      ----------
      scale: float or list of floats
          The scaling factor for all values in the image channels.
  
      bias: float or list of floats
          * If ``color_layout`` is ``ct.colorlayout.GRAYSCALE`` or
            ``ct.colorlayout.GRAYSCALE_FLOAT16``, bias would be a ``float``.
          * If ``color_layout`` is ``ct.colorlayout.RGB`` or ``ct.colorlayout.BGR``,
            bias would be a list of ``float``.
  
      color_layout: string or enumeration of type ``ct.colorlayout``
          Color layout of the image. Valid values are as follows:
  
          Enumeration (recommended):
              * ``ct.colorlayout.RGB``
              * ``ct.colorlayout.BGR``
              * ``ct.colorlayout.GRAYSCALE``
              * ``ct.colorlayout.GRAYSCALE_FLOAT16``
  
          String values (older way to specify):
              * ``'G'``: Grayscale (maps to ``ct.colorlayout.GRAYSCALE``)
              * ``'RGB'``: [Red, Green, Blue] (maps to ``ct.colorlayout.BGR``)
              * ``'BGR'``: [Blue, Green, Red] (maps to ``ct.colorlayout.RGB``)
  
      channel_first: (bool) or None
          Set to ``True`` if input format is channel first.
  
          Default format:
              * For TensorFlow: channel last (``channel_first=False``).
              * For PyTorch: channel first (``channel_first=True``).
      """
      super(ImageType, self).__init__(name, shape)
      self.scale = scale
      msg = (
          "color_layout should be an enum of type ct.colorlayout, i.e. one of: "
          "{ct.colorlayout.RGB, ct.colorlayout.BGR, "
          "ct.colorlayout.GRAYSCALE, ct.colorlayout.GRAYSCALE_FLOAT16}"
      )
      if not (
          isinstance(color_layout, str)
          or isinstance(color_layout, ColorLayout)
      ):
          raise ValueError(msg)
      if isinstance(color_layout, str):
          if color_layout not in ("G", "RGB", "BGR"):
              raise ValueError(msg)
          color_layout = ColorLayout(color_layout)
  
      self.color_layout = color_layout
      if color_layout == ColorLayout.GRAYSCALE_FLOAT16:
          self.dtype = types.fp16
      if bias is None:
          if color_layout in (
              ColorLayout.GRAYSCALE,
              ColorLayout.GRAYSCALE_FLOAT16,
          ):
              self.bias = 0.0
          else:
              self.bias = [0.0, 0.0, 0.0]
      else:
          self.bias = bias
      self.channel_first = channel_first
  
imports: from enum import Enum
  from typing import Optional
  import numpy
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.types.symbolic import is_symbolic
  from coremltools.converters.mil.mil.types.type_mapping import is_builtin, numpy_type_to_builtin_type
label_desc: Use image node_id 1 to create a new ImageType object from inherited base classes: InputType with example: obj = ImageType(name, shape, scale, bias, color_layout, channel_first)