Skip to contents

Fills the input Tensor with values drawn from the uniform distribution

Usage

nn_init_uniform_(tensor, a = 0, b = 1)

Arguments

tensor

an n-dimensional Tensor

a

the lower bound of the uniform distribution

b

the upper bound of the uniform distribution

Examples

if (torch_is_installed()) {
w <- torch_empty(3, 5)
nn_init_uniform_(w)
}
#> torch_tensor
#>  0.0739  0.3743  0.0942  0.8909  0.3481
#>  0.4580  0.8720  0.3197  0.5685  0.5684
#>  0.2061  0.7217  0.4587  0.3881  0.6830
#> [ CPUFloatType{3,5} ]