truncated_normal

dragon.random.truncated_normal(
  shape,
  mean=0,
  std=1,
  dtype='float32',
  **kwargs
)[source]

Return a tensor initialized from the truncated normal distribution.

The TruncatedNormal distribution is defined as:

\[X \sim TN(\mu, \sigma, \mu - 2\sigma, \mu + 2\sigma) \]
Parameters:
  • shape (Sequence[Union[int, dragon.Tensor]]) – The shape of the tensor.
  • mean (number, optional, default=0) – The value of \(\mu\).
  • std (number, optional, default=1) – The value of \(\sigma\).
  • dtype (str, optional, default='float32') – The optional data type.
Returns:

dragon.Tensor – The output tensor.