nvidia.dali.fn.experimental.inflate#

nvidia.dali.fn.experimental.inflate(__input, /, *, shape, algorithm='LZ4', bytes_per_sample_hint=[0], chunk_offsets=None, chunk_sizes=None, dtype=DALIDataType.UINT8, layout='', preserve=False, seed=-1, sequence_axis_name='F', device=None, name=None)#

Inflates/decompresses the input using specified decompression algorithm.

The input must be a 1D tensor of bytes (uint8). Passing the shape and dtype of the decompressed samples is required.

Each input sample can either be a single compressed chunk or consist of multiple compressed chunks that have the same shape and type when inflated, so that they can be be merged into a single tensor where the outermost extent of the tensor corresponds to the number of the chunks.

If the sample is comprised of multiple chunks, the chunk_offsets or chunk_sizes must be specified. In that case, the shape must describe the shape of a single inflated (output) chunk. The number of the chunks will automatically be added as the outermost extent to the output tensors.

For example, the following snippet presents decompression of a video-like sequences. Each video sequence was deflated by, first, compressing each frame separately and then concatenating compressed frames from the corresponding sequences.:

@pipeline_def
def inflate_sequence_pipeline():
  compressed_seq, uncompressed_hwc_shape, compressed_chunk_sizes = fn.external_source(...)
  sequences = fn.experimental.inflate(
      compressed_seq.gpu(),
      chunk_sizes=compressed_chunk_sizes,  # refers to sizes in ``compressed_seq``
      shape=uncompressed_hwc_shape,
      layout="HWC",
      sequence_axis_name="F")
  return sequences
Supported backends
  • ‘gpu’

Parameters:

__input (TensorList) – Input to the operator.

Keyword Arguments:
  • shape (int or list of int or TensorList of int) – The shape of the output (inflated) chunk.

  • algorithm (str, optional, default = ‘LZ4’) –

    Algorithm to be used to decode the data.

    Currently only LZ4 is supported.

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

  • chunk_offsets (int or list of int or TensorList of int, optional) –

    A list of offsets within the input sample describing where the consecutive chunks begin.

    If the chunk_sizes is not specified, it is assumed that the chunks are densely packed in the input tensor and the last chunk ends with the sample’s end.

  • chunk_sizes (int or list of int or TensorList of int, optional) –

    A list of sizes of corresponding input chunks.

    If the chunk_offsets is not specified, it is assumed that the chunks are densely packed in the input tensor and the first chunk starts at the beginning of the sample.

  • dtype (nvidia.dali.types.DALIDataType, optional, default = DALIDataType.UINT8) – The output (inflated) data type.

  • layout (layout str, optional, default = ‘’) –

    Layout of the output (inflated) chunk.

    If the samples consist of multiple chunks, additionally, the sequence_axis_name extent will be added to the beginning of the specified layout.

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

  • sequence_axis_name (layout str, optional, default = ‘F’) –

    The name for the sequence axis.

    If the samples consist of multiple chunks, an extra outer dimension will be added to the output tensor. By default, it is assumed to be video frames, hence the default label ‘F’

    The value is ignored if the layout is not specified or the input is not a sequence ( neither chunk_offsets nor chunk_sizes is specified).