TruncatedNormal

class dragon.vm.tensorflow.keras.initializers.TruncatedNormal(
  mean=0,
  stddev=1,
  dtype='float32'
)[source]

Fill tensors according to a truncated normal distribution.

The TruncatedNormal distribution is defined as:

\[X \sim TN(\mu, \sigma, \mu - 2\sigma, \mu + 2\sigma) \]

__init__

TruncatedNormal.__init__(
  mean=0,
  stddev=1,
  dtype='float32'
)[source]

Create a TruncatedNormal initializer.

Parameters:
  • mean (number, optional, default=0) – The mean of distribution.
  • stddev (number, optional, default=1) – The stddev of distribution.
  • dtype (str, optional, default='float32') – The data type to set as default.

Methods

__call__

TruncatedNormal.__call__(
  shape,
  dtype=None,
  **kwargs
)[source]

Return a tensor initialized from the initializer.

Parameters:
  • shape (Sequence[int]) – The tensor shape.
  • dtype (str, optional) – The optional data type.
Returns:

dragon.Tensor – The output tensor.