Is there a way to create a tensor using a per-channel means and std? For instance, I have two tensors mean
and std
with k
values each, and I would like to generate an output
tensor which is a stack of k
tensors generated from normal distributions using each mean and std value. What would be an efficient way to do it? Essentially, I would like to do the following:
output = torch.empty(shape)
for i in range(k):
output[:, i, ...] = output[:, i, ...].normal_(mean=mean[i], std=std[i])
Is there a better way of achieving this? Thanks in advance!