nvidia.dali.fn.multi_paste

nvidia.dali.fn.multi_paste(__input_0, /, *__input_, bytes_per_sample_hint=[0], dtype=None, in_anchors=None, in_anchors_rel=None, in_ids=None, out_anchors=None, out_anchors_rel=None, output_size=None, preserve=False, seed=-1, shapes=None, shapes_rel=None, device=None, name=None)

Performs multiple pastes from image batch to each of the outputs.

If the in_ids is specified, the operator expects exactly one input batch. In that case, for each output sample, in_ids describes which samples from the input batch should be pasted to the corresponding sample in the output batch.

If the in_ids argument is omitted, the operator accepts multiple inputs. In that case, the i-th sample from each input batch will be pasted to the i-th sample of the output batch. All the input batches must have the same type and device placement.

If the input shapes are uniform and no explicit output_size is provided, the operator assumes the same output shape (the output canvas size). Otherwise, the output_size must be specified.

This operator can also change the type of data.

This operator allows sequence inputs.

Supported backends
  • ‘cpu’

  • ‘gpu’

Parameters:
  • __input_0 (TensorList ('HWC', 'FHWC')) – Input to the operator.

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

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

  • in_anchors (int or TensorList of int, optional) –

    Absolute coordinates of the top-left corner of the source region.

    The anchors are represented as 2D tensors where the first dimension is equal to the number of pasted regions and the second one is 2 (for the H and W extents).

    If neither in_anchors nor in_anchors_rel are provided, all anchors are zero.

    Supports per-frame inputs.

  • in_anchors_rel (float or TensorList of float, optional) –

    Relative coordinates of the top-left corner of the source region.

    The argument works like in_anchors, but the values should be floats in [0, 1] range, describing the anchor placement relative to the input sample shape.

    Supports per-frame inputs.

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

    Indices of the inputs to paste data from.

    If specified, the operator accepts exactly one batch as an input.

  • out_anchors (int or TensorList of int, optional) –

    Absolute coordinates of the top-left corner of the pasted region in the output canvas.

    The anchors are represented as 2D tensors where the first dimension is equal to the number of pasted regions and the second one is 2 (for the H and W extents).

    If neither out_anchors nor out_anchors_rel are provided, all anchors are zero, making all the pasted regions start at the top-left corner of the output canvas.

    Supports per-frame inputs.

  • out_anchors_rel (float or TensorList of float, optional) –

    Relative coordinates of the top-left corner of the pasted region in the output canvas.

    Works like out_anchors argument, but the values should be floats in [0, 1] range, describing the top-left corner of the pasted region relative to the output canvas size.

    Supports per-frame inputs.

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

    A tuple (H, W) describing the output shape (i.e. the size of the canvas for the output pastes).

    Can be omitted if the operator is run with inputs of uniform shape. In that case, the same shape is used as the canvas 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.

  • shapes (int or TensorList of int, optional) –

    Shape of the paste regions.

    The shapes are represented as 2D tensors where the first dimension is equal to the number of pasted regions and the second one is 2 (for the H and W extents).

    If neither shapes nor shapes_rel are provided, the shape is calculated so that the region spans from the input anchor until the end of the input image.

    Supports per-frame inputs.

  • shapes_rel (float or TensorList of float, optional) –

    Relative shape of the paste regions.

    Works like shape argument, but the values should be floats in [0, 1] range, describing the paste region shape relative to the input shape.

    Supports per-frame inputs.