nvidia.dali.fn.rotate(__input, /, *, angle, axis=[], bytes_per_sample_hint=[0], dtype=None, fill_value=None, interp_type=DALIInterpType.INTERP_LINEAR, keep_size=False, preserve=False, seed=-1, size=[], device=None, name=None)#

Rotates the images by the specified angle.

This operator supports volumetric data.

Supported backends
  • ‘cpu’

  • ‘gpu’


__input (TensorList ('HWC', 'FHWC', 'DHWC', 'FDHWC')) – Input to the operator.

Keyword Arguments:
  • angle (float or TensorList of float) –

    Angle, in degrees, by which the image is rotated.

    For two-dimensional data, the rotation is counter-clockwise, assuming the top-left corner is at (0,0). For three-dimensional data, the angle is a positive rotation around the provided axis.

    Supports per-frame inputs.

  • axis (float or list of float or TensorList of float, optional, default = []) –

    Applies only to three-dimension and is the axis around which to rotate the image.

    The vector does not need to be normalized, but it must have a non-zero length. Reversing the vector is equivalent to changing the sign of angle.

    Supports per-frame inputs.

  • bytes_per_sample_hint (int or list of int, optional, default = [0]) –

    Output size hint, in bytes per sample.

    If specified, the operator’s outputs residing in GPU or page-locked host memory will be preallocated to accommodate a batch of samples of this size.

  • dtype (nvidia.dali.types.DALIDataType, optional) –

    Output data type.

    If not set, the input type is used.

  • fill_value (float, optional) –

    Value used to fill areas that are outside the source image.

    If a value is not specified, the source coordinates are clamped and the border pixel is repeated.

  • interp_type (nvidia.dali.types.DALIInterpType, optional, default = DALIInterpType.INTERP_LINEAR) – Type of interpolation used.

  • keep_size (bool, optional, default = False) –

    If True, original canvas size is kept.

    If set to False (default), and the size is not set, the canvas size is adjusted to accommodate the rotated image with the least padding possible.

  • preserve (bool, optional, default = False) – Prevents the operator from being removed from the graph even if its outputs are not used.

  • seed (int, optional, default = -1) –

    Random seed.

    If not provided, it will be populated based on the global seed of the pipeline.

  • size (float or list of float or TensorList of float, optional, default = []) –

    Output size, in pixels/points.

    Non-integer sizes are rounded to nearest integer. The channel dimension should be excluded (for example, for RGB images, specify (480,640), not (480,640,3).

  • output_dtype (nvidia.dali.types.DALIDataType) –


    The argument output_dtype is a deprecated alias for dtype. Use dtype instead.