Returns a tensor filled with random numbers from a uniform distribution on the interval [0, 1).
tch_rand(sizes, dtype = NULL, layout = NULL, device = NULL, requires_grad = FALSE)
sizes | a sequence of integers defining the shape of the output tensor. |
---|---|
dtype | the desired data type of returned tensor. Default: if |
device | the desired device of returned tensor. Default: if |
requires_grad | If autograd should record operations on the
returned tensor. Default: |
the | desired layout of returned Tensor. Default: 'strided' |
The shape of the tensor is defined by the variable argument sizes.
#> tensor #> 0.4566 0.9066 #> 0.6002 0.6302 #> [ Variable[CPUFloatType]{2,2} ]#> tensor #> 0.0263 0.4783 #> 0.3129 0.3477 #> [ Variable[CPUDoubleType]{2,2} ]