GlorotUniform

class dragon.vm.tensorlayer.initializers.GlorotUniform(
  mode='fan_in',
  scale=3.0
)[source]

Fill tensor from a glorot uniform distribution.

\[\text{tensor} \sim \mathcal{U}(-\sqrt{\frac{\text{scale}}{\text{fan}}}, \sqrt{\frac{\text{scale}}{\text{fan}}}) \]

__init__

GlorotUniform.__init__(
  mode='fan_in',
  scale=3.0
)[source]

Create a GlorotUniform initializer.

Parameters:
  • mode ({'fan_in', 'fan_out', 'fan_avg'}, optional) – The mode to compute the fans.
  • scale (float, optional, default=3.0) – The scale factor to distribution.

Methods

__call__

Initializer.__call__(
  shape,
  dtype='float32',
  **kwargs
)[source]

Return a tensor initialized as specified initializer.

Parameters:
  • shape (Sequence[int]) – The shape of the tensor.
  • dtype (str, optional, default='float32') – The optional data type.
Returns:

dragon.Tensor – The output tensor.