sampling_id

paddle.fluid.layers.nn. sampling_id ( x, min=0.0, max=1.0, seed=0, dtype='float32' ) [source]

This op is used for sampling id from multinomial distribution from the input, sampling one id for one sample.

Parameters
  • x (Variable) – 2-D tensor, [batch_size, input_feature_dimensions]

  • min (Float) – minimum , default 0.0.

  • max (Float) – maximum, default 1.0.

  • seed (Float) – Random seed, default 0. if seed is not 0, will generate same number every time.

  • dtype (np.dtype|core.VarDesc.VarType|str) – The type of output data : float32, float_16, int etc

Returns

sampling tensor.

Return type

Variable

Examples

import paddle.fluid as fluid
x = fluid.data(
    name="X",
    shape=[13, 11],
    dtype='float32')

out = fluid.layers.sampling_id(x)