UniformInitializer

class paddle.fluid.initializer.UniformInitializer(low=-1.0, high=1.0, seed=0, diag_num=0, diag_step=0, diag_val=1.0)[source]

Implements the random uniform distribution initializer

Parameters
  • low (float) – lower boundary of the uniform distribution

  • high (float) – upper boundary of the uniform distribution

  • seed (int) – random seed

  • diag_num (int) – the number of diagonal elements to initialize. If set to 0, diagonal initialization will be not performed.

  • diag_step (int) – Step size between two diagonal elements, which is generally the width of the square matrix.

  • diag_val (float) – the value of the diagonal element to be initialized, default 1.0. It takes effect only if the diag_num is greater than 0.

Examples

import paddle.fluid as fluid
x = fluid.data(name='x', shape=[None, 1], dtype='float32')
fc = fluid.layers.fc(input=x, size=10,
    param_attr=fluid.initializer.Uniform(low=-0.5, high=0.5))