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.4346  0.2179  0.3907  0.1867  0.9405
#>  0.1371  0.6848  0.6871  0.0056  0.2274
#>  0.2400  0.4104  0.0138  0.8934  0.1748
#> [ CPUFloatType{3,5} ]