code: def rand_augment(
      data: _DataNode,
      n: int,
      m: int,
      num_magnitude_bins: int = 31,
      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,
      monotonic_mag: bool = True,
      excluded: Optional[List[str]] = None,
  ) -> _DataNode:
      """
      Applies RandAugment (https://arxiv.org/abs/1909.13719) augmentation scheme 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`.
      n: int
          The number of randomly sampled operations to be applied to a sample.
      m: int
          A magnitude (strength) of each operation to be applied, it must be an integer
          within ``[0, num_magnitude_bins - 1]``.
      num_magnitude_bins: int, optional
          The number of bins to divide the magnitude ranges into.
      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 ``shapes`` 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 100, which means the maximal magnitude
          shifts the image by 100 pixels.
      max_translate_rel: float or (float, float), optional
          Only valid when ``shapes`` 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 around `0.45` (100/224).
      seed: int, optional
          Seed to be used to randomly sample operations (and to negate magnitudes).
      monotonic_mag: bool, optional
          There are two flavours of RandAugment available in different frameworks. For the default
          ``monotonic_mag=True`` the strength of operations that accept magnitude bins increases with
          the increasing bins. If set to False, the magnitude ranges for some color operations differ.
          There, the :meth:`~nvidia.dali.auto_aug.augmentations.posterize` and
          :meth:`~nvidia.dali.auto_aug.augmentations.solarize` strength decreases with increasing
          magnitude bins and enhance operations (
          :meth:`~nvidia.dali.auto_aug.augmentations.brightness`,
          :meth:`~nvidia.dali.auto_aug.augmentations.contrast`,
          :meth:`~nvidia.dali.auto_aug.augmentations.color`,
          :meth:`~nvidia.dali.auto_aug.augmentations.sharpness`) use (0.1, 1.9) range,
          which means that the strength decreases the closer the magnitudes are to the center
          of the range. See
          :meth:`~nvidia.dali.auto_aug.rand_augment.get_rand_augment_non_monotonic_suite`.
      excluded: List[str], optional
          A list of names of the operations to be excluded from the default suite of augmentations.
          If, instead of just limiting the set of operations, you need to include some custom
          operations or fine-tune the existing ones, you can use the
          :meth:`~nvidia.dali.auto_aug.rand_augment.apply_rand_augment` directly, which accepts
          a list of augmentations.
  
      Returns
      -------
      DataNode
          A batch of transformed samples.
      """
      aug_kwargs = {
          "fill_value": fill_value,
          "interp_type": interp_type,
      }
      use_shape = shape is not None
      if use_shape:
          aug_kwargs["shape"] = shape
      if monotonic_mag:
          augmentations = get_rand_augment_suite(
              use_shape, max_translate_abs, max_translate_rel
          )
      else:
          augmentations = get_rand_augment_non_monotonic_suite(
              use_shape, max_translate_abs, max_translate_rel
          )
      augmentation_names = set(aug.name for aug in augmentations)
      assert len(augmentation_names) == len(augmentations)
      excluded = excluded or []
      for name in excluded:
          if name not in augmentation_names:
              raise Exception(
                  f"The `{name}` was specified in `excluded`, but the RandAugment suite "
                  f"does not contain augmentation with this name. "
                  f"The augmentations in the suite are: {', '.join(augmentation_names)}."
              )
      selected_augments = [
          aug for aug in augmentations if aug.name not in excluded
      ]
      return apply_rand_augment(
          selected_augments,
          data,
          n,
          m,
          num_magnitude_bins=num_magnitude_bins,
          seed=seed,
          **aug_kwargs,
      )
  
file_path: DALI/dali/python/nvidia/dali/auto_aug/rand_augment.py
imports: import warnings
  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 signed_bin, _Augmentation
  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: rand_augment(data, n, m, num_magnitude_bins, shape, fill_value, interp_type, max_translate_abs, max_translate_rel, seed, monotonic_mag, excluded) and returns: apply_rand_augment