Learn R Programming

torch (version 0.1.0)

torch_normal: Normal

Description

Normal

Usage

torch_normal(mean, std = 1L, size, generator = NULL)

Arguments

mean

(Tensor) the tensor of per-element means

std

(Tensor) the tensor of per-element standard deviations

size

(int...) a sequence of integers defining the shape of the output tensor.

generator

(torch.Generator, optional) a pseudorandom number generator for sampling

normal(mean, std, *, generator=NULL, out=NULL) -> Tensor

Returns a tensor of random numbers drawn from separate normal distributions whose mean and standard deviation are given.

The mean is a tensor with the mean of each output element's normal distribution

The std is a tensor with the standard deviation of each output element's normal distribution

The shapes of mean and std don't need to match, but the total number of elements in each tensor need to be the same.

normal(mean=0.0, std, out=NULL) -> Tensor

Similar to the function above, but the means are shared among all drawn elements.

normal(mean, std=1.0, out=NULL) -> Tensor

Similar to the function above, but the standard-deviations are shared among all drawn elements.

normal(mean, std, size, *, out=NULL) -> Tensor

Similar to the function above, but the means and standard deviations are shared among all drawn elements. The resulting tensor has size given by size.

Examples

Run this code
# NOT RUN {
if (torch_is_installed()) {

# }
# NOT RUN {
torch_normal(mean=0, std=torch_arange(1, 0, -0.1))


torch_normal(mean=0.5, std=torch_arange(1., 6.))


torch_normal(mean=torch_arange(1., 6.))


torch_normal(2, 3, size=list(1, 4))
# }
# NOT RUN {
}
# }

Run the code above in your browser using DataLab