nvidia.dali.fn.uniform

nvidia.dali.fn.uniform(*inputs, **kwargs)

Warning

This operator is now deprecated. Use random.uniform() instead.

Generates random numbers following a uniform distribution.

It can be configured to produce a continuous uniform distribution in the range [min, max), or a discrete uniform distribution where any of the specified values [v0, v1, …, vn] occur with equal probability.

The shape of the generated data can be either specified explicitly with a shape argument, or chosen to match the shape of the input, if provided. If none are present, a scalar is generated.

Supported backends
  • ‘cpu’

  • ‘gpu’

Parameters

input (TensorList, optional) – Input to the operator.

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.

    Note

    The generated numbers are converted to the output data type, rounding and clamping if necessary.

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

  • range (float or list of float or TensorList of float, optional, default = [-1.0, 1.0]) –

    Range [min, max) of a continuous uniform distribution.

    This argument is mutually exclusive with values.

    Warning

    When specifying an integer type as dtype, the generated numbers can go outside the specified range, due to rounding.

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

    Random seed.

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

  • shape (int or list of int or TensorList of int, optional) – Shape of the output data.

  • values (float or list of float or TensorList of float, optional) –

    The discrete values [v0, v1, …, vn] produced by a discrete uniform distribution.

    This argument is mutually exclusive with range.