nvidia.dali.fn.stack(__input_0, /, *__input_, axis=0, axis_name=None, bytes_per_sample_hint=[0], preserve=False, seed=-1, device=None, name=None)#

Joins the input tensors along a new axis.

The shapes of respective tensors in the inputs must match.

Supported backends
  • ‘cpu’

  • ‘gpu’

  • __input_0 (TensorList) – Input to the operator.

  • __input_[1..998] (TensorList, optional) – This function accepts up to 998 optional positional inputs

Keyword Arguments:
  • axis (int, optional, default = 0) –

    The axis in the output tensor along which the inputs are stacked.

    The axis is inserted before a corresponding axis in the inputs. A value of 0 indicates that whole tensors are stacked. Specifying axis equal to the number of dimensions in the inputs causes the values from the inputs to be interleaved).

    Accepted range is [-ndim, ndim]. Negative indices are counted from the back.

  • axis_name (str, optional) –

    Name of the new axis to be inserted.

    A one-character string that will denote the new axis in the output layout. The output layout will be constructed by inserting that character into the input layout at the position indicated by axis. For example, specifying axis = 0 and axis_name = "C" with input layout “HW” will yield the output layout “CHW”

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

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