r"""Fills the given ``tensor`` with random value sampled from uniform distribution :math:`\mathcal{U}(\text{a}, \text{b})`. Args: tensor: tensor to be initialized. a: lower bound of the sampling interval. b: upper bound of the sampling interval.
(tensor: Tensor, a: float = 0.0, b: float = 1.0)
| 39 | |
| 40 | |
| 41 | def uniform_(tensor: Tensor, a: float = 0.0, b: float = 1.0) -> None: |
| 42 | r"""Fills the given ``tensor`` with random value sampled from uniform distribution |
| 43 | :math:`\mathcal{U}(\text{a}, \text{b})`. |
| 44 | |
| 45 | Args: |
| 46 | tensor: tensor to be initialized. |
| 47 | a: lower bound of the sampling interval. |
| 48 | b: upper bound of the sampling interval. |
| 49 | """ |
| 50 | tensor._reset(uniform(size=tensor.shape, low=a, high=b).astype(tensor.dtype)) |
| 51 | |
| 52 | |
| 53 | def normal_(tensor: Tensor, mean: float = 0.0, std: float = 1.0) -> None: |
no test coverage detected