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.9775  0.7917  0.6477  0.2337  0.0261
#>  0.9267  0.4705  0.3090  0.4401  0.1671
#>  0.3938  0.8689  0.3312  0.1128  0.8623
#> [ CPUFloatType{3,5} ]