code: def invert_colors(img: tf.Tensor, min_val: float = 0.6) -> tf.Tensor:
      """Invert the colors of an image
  
      Args:
      ----
          img : tf.Tensor, the image to invert
          min_val : minimum value of the random shift
  
      Returns:
      -------
          the inverted image
      """
      out = tf.image.rgb_to_grayscale(img)  # Convert to gray
      # Random RGB shift
      shift_shape = (
          [img.shape[0], 1, 1, 3] if img.ndim == 4 else [1, 1, 3]
      )
      rgb_shift = tf.random.uniform(
          shape=shift_shape, minval=min_val, maxval=1
      )
      # Inverse the color
      if out.dtype == tf.uint8:
          out = tf.cast(
              tf.cast(out, dtype=rgb_shift.dtype) * rgb_shift,
              dtype=tf.uint8,
          )
      else:
          out *= tf.cast(rgb_shift, dtype=out.dtype)
      # Inverse the color
      out = 255 - out if out.dtype == tf.uint8 else 1 - out
      return out
  
file_path: doctr/doctr/transforms/functional/tensorflow.py
imports: import math
  import random
  from copy import deepcopy
  from typing import Iterable, Optional, Tuple, Union
  import numpy
  import tensorflow
  from doctr.utils.geometry import compute_expanded_shape, rotate_abs_geoms
  from .base import create_shadow_mask, crop_boxes
label_desc: Use image node_id 1 for calling a global function with example usage: invert_colors(img, min_val) and returns: out