glorot_uniform

dragon.random.glorot_uniform(
  shape,
  mode='fan_in',
  scale=3.0,
  dtype='float32',
  **kwargs
)[source]

Return a tensor initialized from the glorot uniform distribution.

\[\text{out} \sim \mathcal{U}(-\sqrt{\frac{scale}{\text{fan}}}, \sqrt{\frac{scale}{\text{fan}}}) \]
Parameters:
  • shape (Sequence[Union[int, dragon.Tensor]]) The tensor shape.
  • mode ({'fan_in', 'fan_out', 'fan_avg'}, optional) The mode to compute fans.
  • scale (float, optional, default=3.0) The scale factor to distribution.
  • dtype (str, optional, default='float32') The optional data type.
Returns:

dragon.Tensor The output tensor.