normal#
- sionna.phy.utils.normal(size: Sequence[int], *, mean: float = 0.0, std: float = 1.0, dtype: torch.dtype | None = None, device: str | torch.device | None = None, generator: torch._C.Generator | None = None) torch.Tensor[source]#
Generate random normal tensor, compile-aware.
In eager mode, uses the provided generator for reproducibility. In compiled mode, uses torch.randn (which uses the Graph RNG) to ensure proper synchronization with other random operations like randint.
Note: torch.normal uses a different RNG stream than torch.randn under torch.compile, which can cause training issues. Using torch.randn with scaling ensures consistent RNG behavior.
- Parameters:
mean (float) – Mean of the distribution. Defaults to 0.0.
std (float) – Standard deviation of the distribution. Defaults to 1.0.
dtype (torch.dtype | None) – Data type of the output tensor.
device (str | torch.device | None) – Device for the output tensor.
generator (torch._C.Generator | None) – Random number generator (used only in eager mode).
- Outputs:
samples – Tensor with random normal values.