parameters: (input, illuminant="D65", observer="2", name=None)
return_statement: return tf.stack([l, a, b], axis=-1)
docstring: Convert a RGB image to CIE LAB.
  
      Args:
        input: A 3-D (`[H, W, 3]`) or 4-D (`[N, H, W, 3]`) Tensor.
        illuminant : {"A", "D50", "D55", "D65", "D75", "E"}, optional
          The name of the illuminant (the function is NOT case sensitive).
        observer : {"2", "10"}, optional
          The aperture angle of the observer.
        name: A name for the operation (optional).
  
      Returns:
        A 3-D (`[H, W, 3]`) or 4-D (`[N, H, W, 3]`) Tensor.
docstring_summary: Convert a RGB image to CIE LAB.
docstring_tokens: Convert a RGB image to CIE LAB .
function: def rgb_to_lab(input, illuminant="D65", observer="2", name=None):
      """
      Convert a RGB image to CIE LAB.
  
      Args:
        input: A 3-D (`[H, W, 3]`) or 4-D (`[N, H, W, 3]`) Tensor.
        illuminant : {"A", "D50", "D55", "D65", "D75", "E"}, optional
          The name of the illuminant (the function is NOT case sensitive).
        observer : {"2", "10"}, optional
          The aperture angle of the observer.
        name: A name for the operation (optional).
  
      Returns:
        A 3-D (`[H, W, 3]`) or 4-D (`[N, H, W, 3]`) Tensor.
      """
      input = tf.convert_to_tensor(input)
      assert input.dtype in (tf.float16, tf.float32, tf.float64)
  
      illuminants = {
          "A": {
              "2": (1.098466069456375, 1, 0.3558228003436005),
              "10": (1.111420406956693, 1, 0.3519978321919493),
          },
          "D50": {
              "2": (0.9642119944211994, 1, 0.8251882845188288),
              "10": (0.9672062750333777, 1, 0.8142801513128616),
          },
          "D55": {
              "2": (0.956797052643698, 1, 0.9214805860173273),
              "10": (0.9579665682254781, 1, 0.9092525159847462),
          },
          "D65": {
              "2": (0.95047, 1.0, 1.08883),
              "10": (0.94809667673716, 1, 1.0730513595166162),
          },
          "D75": {
              "2": (0.9497220898840717, 1, 1.226393520724154),
              "10": (0.9441713925645873, 1, 1.2064272211720228),
          },
          "E": {"2": (1.0, 1.0, 1.0), "10": (1.0, 1.0, 1.0)},
      }
      coords = tf.constant(illuminants[illuminant.upper()][observer], input.dtype)
  
      xyz = rgb_to_xyz(input)
  
      xyz = xyz / coords
  
      xyz = tf.where(
          tf.math.greater(xyz, 0.008856),
          tf.math.pow(xyz, 1.0 / 3.0),
          xyz * 7.787 + 16.0 / 116.0,
      )
  
      xyz = tf.unstack(xyz, axis=-1)
      x, y, z = xyz[0], xyz[1], xyz[2]
  
      # Vector scaling
      l = (y * 116.0) - 16.0
      a = (x - y) * 500.0
      b = (y - z) * 200.0
  
      return tf.stack([l, a, b], axis=-1)
function_tokens: def rgb_to_lab ( input , illuminant = "D65" , observer = "2" , name = None ) : input = tf . convert_to_tensor ( input ) assert input . dtype in ( tf . float16 , tf . float32 , tf . float64 ) illuminants = { "A" : { "2" : ( 1.098466069456375 , 1 , 0.3558228003436005 ) , "10" : ( 1.111420406956693 , 1 , 0.3519978321919493 ) , } , "D50" : { "2" : ( 0.9642119944211994 , 1 , 0.8251882845188288 ) , "10" : ( 0.9672062750333777 , 1 , 0.8142801513128616 ) , } , "D55" : { "2" : ( 0.956797052643698 , 1 , 0.9214805860173273 ) , "10" : ( 0.9579665682254781 , 1 , 0.9092525159847462 ) , } , "D65" : { "2" : ( 0.95047 , 1.0 , 1.08883 ) , "10" : ( 0.94809667673716 , 1 , 1.0730513595166162 ) , } , "D75" : { "2" : ( 0.9497220898840717 , 1 , 1.226393520724154 ) , "10" : ( 0.9441713925645873 , 1 , 1.2064272211720228 ) , } , "E" : { "2" : ( 1.0 , 1.0 , 1.0 ) , "10" : ( 1.0 , 1.0 , 1.0 ) } , } coords = tf . constant ( illuminants [ illuminant . upper ( ) ] [ observer ] , input . dtype ) xyz = rgb_to_xyz ( input ) xyz = xyz / coords xyz = tf . where ( tf . math . greater ( xyz , 0.008856 ) , tf . math . pow ( xyz , 1.0 / 3.0 ) , xyz * 7.787 + 16.0 / 116.0 , ) xyz = tf . unstack ( xyz , axis = - 1 ) x , y , z = xyz [ 0 ] , xyz [ 1 ] , xyz [ 2 ] # Vector scaling l = ( y * 116.0 ) - 16.0 a = ( x - y ) * 500.0 b = ( y - z ) * 200.0 return tf . stack ( [ l , a , b ] , axis = - 1 )