paddle.fluid.layers.nn. gaussian_random_batch_size_like ( input, shape, input_dim_idx=0, output_dim_idx=0, mean=0.0, std=1.0, seed=0, dtype='float32' ) [source]

Used to initialize tensors with gaussian random generator. The default mean of the distribution is 0, and default standard deviation (std) of the distribution is 1.0. Uers can set mean and std via input arguments.

  • input (Variable) – Tensor whose input_dim_idx’th dimension specifies the batch_size

  • shape (tuple|list) – The shape of the output

  • input_dim_idx (int) – default 0. The index of input’s batch size dimension

  • output_dim_idx (int) – default 0. The index of output’s batch size dimension

  • mean (float) – (float, default 0.0) The mean (or center) of the gaussian distribution

  • std (float) – (float, default 1.0) The standard deviation (std, or spread) of the gaussian distribution

  • seed (int) – (int, default 0) Random seed of generator.0 means don’t specify random seed.Note that if seed is not 0, this operator will always generate the same random numbers every time

  • dtype (np.dtype|core.VarDesc.VarType|str) – The type of output data, float32 or float_64.


Tensor of specified shape will be filled with the specified value

Return type

out (Variable)


import paddle
import paddle.fluid as fluid

input ="input", shape=[13, 11], dtype='float32')

out = fluid.layers.gaussian_random_batch_size_like(
    input, shape=[-1, 11], mean=1.0, std=2.0)