EDIT: I simplified the question here:

  
    
    
    How to instantiate axis-aligned multivariate Gaussian? 
  
  
    It is straightforward to do the following and wrap a Gaussian into an Independent. So if we are given a 
loc = [batch_size, event_shape]
scale = [batch_size]


loc = torch.zeros(5, 3, 2)
scale = torch.ones(2)
normal = Normal(loc, scale)
normal.batch_shape, normal.event_shape
(torch.Size([5, 3, 2]), torch.Size([]))

ind = Independent(normal, 1)
ind.batch_shape, ind.event_shape
(torch.Size([5, 3]), torch.Size([2]))

This Independent distribution is identical to a MultivariateNormal defined as: 
mv…