code: def auto_augment(
      data: _DataNode,
      policy_name: str = "image_net",
      shape: Optional[Union[_DataNode, Tuple[int, int]]] = None,
      fill_value: Optional[int] = 128,
      interp_type: Optional[types.DALIInterpType] = None,
      max_translate_abs: Optional[int] = None,
      max_translate_rel: Optional[float] = None,
      seed: Optional[int] = None,
  ) -> _DataNode:
      """
      Applies one of the predefined policies from the AutoAugment
      paper (https://arxiv.org/abs/1805.09501) to the provided batch of samples.
  
      Args
      ----
      data : DataNode
          A batch of samples to be processed. The supported samples are images
          of `HWC` layout and videos of `FHWC` layout, the supported data type is `uint8`.
      policy_name : str, optional
          The name of predefined policy. Acceptable values are: `image_net`,
          `reduced_image_net`, `svhn`, `reduced_cifar10`. Defaults to `image_net`.
      shape: DataNode or Tuple[int, int], optional
          The size (height and width) of the image or frames in the video sequence
          passed as the `data`. If specified, the magnitude of `translation` operations
          depends on the image/frame shape and spans from 0 to `max_translate_rel * shape`.
          Otherwise, the magnitude range is `[0, max_translate_abs]` for any sample.
      fill_value: int, optional
          A value to be used as a padding for images/frames transformed with warp_affine ops
          (translation, shear and rotate). If `None` is specified, the images/frames are padded
          with the border value repeated (clamped).
      interp_type: types.DALIInterpType, optional
          Interpolation method used by the warp_affine ops (translation, shear and rotate).
          Supported values are `types.INTERP_LINEAR` (default) and `types.INTERP_NN`.
      max_translate_abs: int or (int, int), optional
          Only valid when `shape` is not provided. Specifies the maximal shift (in pixels)
          in the translation augmentation. If a tuple is specified, the first component limits
          height, the second the width. Defaults to 250, which means the maximal magnitude
          shifts the image by 250 pixels.
      max_translate_rel: float or (float, float), optional
          Only valid when `shape` argument is provided. Specifies the maximal shift as a
          fraction of image shape in the translation augmentations.
          If a tuple is specified, the first component limits the height, the second the width.
          Defaults to 1, which means the maximal magnitude shifts the image entirely out of
          the canvas.
      seed: int, optional
          Seed to be used to randomly sample operations (and to negate magnitudes).
  
      Returns
      -------
      DataNode
          A batch of transformed samples.
      """
      predefined_policies = {
          "image_net": get_image_net_policy,
          "reduced_image_net": get_reduced_image_net_policy,
          "svhn": get_svhn_policy,
          "reduced_cifar10": get_reduced_cifar10_policy,
      }
      policies_without_translation = ("reduced_image_net",)
      shape_related_args = (
          (shape, "shape"),
          (max_translate_abs, "max_translate_abs"),
          (max_translate_rel, "max_translate_rel"),
      )
      if (
          not isinstance(policy_name, str)
          or policy_name not in predefined_policies
      ):
          policies_str = ", ".join(
              [f"`{name}`" for name in predefined_policies.keys()]
          )
          raise Exception(
              f"The `policy_name` must be a string that takes one of the values: {policies_str}"
          )
      if policy_name in policies_without_translation:
          shape_arg = next(
              (
                  name
                  for arg, name in shape_related_args
                  if arg is not None
              ),
              None,
          )
          if shape_arg is not None:
              raise Exception(
                  f"The policy `{policy_name}` does not contain any augmentations that rely on the "
                  f"image shape. The `{shape_arg}` argument must not be specified in that case."
              )
  
      aug_kwargs = {
          "fill_value": fill_value,
          "interp_type": interp_type,
      }
      use_shape = shape is not None
      if use_shape:
          aug_kwargs["shape"] = shape
  
      if policy_name in policies_without_translation:
          policy = predefined_policies[policy_name]()
      else:
          policy = predefined_policies[policy_name](
              use_shape=use_shape,
              max_translate_abs=max_translate_abs,
              max_translate_rel=max_translate_rel,
          )
  
      return apply_auto_augment(policy, data, seed, **aug_kwargs)
  
file_path: DALI/dali/python/nvidia/dali/auto_aug/auto_augment.py
imports: from typing import List, Optional, Tuple, Union
  from nvidia.dali import fn
  from nvidia.dali import types
  from nvidia.dali.auto_aug import augmentations
  from nvidia.dali.auto_aug.core import _Augmentation, Policy, signed_bin
  from nvidia.dali.auto_aug.core._args import forbid_unused_kwargs
  from nvidia.dali.auto_aug.core._utils import get_translations, pretty_select
  from nvidia.dali.data_node import DataNode
label_desc: Use image node_id 1 for calling a global function with example usage: auto_augment(data, policy_name, shape, fill_value, interp_type, max_translate_abs, max_translate_rel, seed) and returns: apply_auto_augment