nvidia.dali.fn.expand_dims#

nvidia.dali.fn.expand_dims(
__data,
/,
*,
axes,
bytes_per_sample_hint=[0],
new_axis_names='',
preserve=False,
seed=-1,
device=None,
name=None,
)#

Insert new dimension(s) with extent 1 to the data shape.

The new dimensions are inserted at the positions specified by axes.

If new_axis_names is provided, the new dimension names will be inserted in the data layout, at the positions specified by axes. If new_axis_names is not provided, the output data layout will be empty.”

This operator allows sequence inputs and supports volumetric data.

Supported backends
  • ‘cpu’

  • ‘gpu’

Parameters:

__data (TensorList) – Data to be expanded

Keyword Arguments:
  • axes (int or list of int or TensorList of int) – Indices at which the new dimensions are inserted.

  • 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.

:keyword new_axis_names : layout str, optional, default = ‘’: Names of the new dimensions in the data layout.

The length of new_axis_names must match the length of axes. If argument isn’t be provided, the layout will be cleared.

Keyword Arguments:
  • 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.