Hi all, I’m wondering how I could create a 2D Gaussian distribution, where we have multiple centers, and sample from it? I tried the code below, but whenever I tried to sample a batch, I would get samples from every center. What I actually want is to first create these multiple centers, then re-normalize the distributions such that overlapping regions would have higher probability. Then sample a batch of points out based on this.

If I understand what you want correctly, you have a multigaussian distribution.
That is, your probability distribution is the sum of multiple gaussian distributions
(as distinct from a single random variate being a sum of multiple gaussian
variates).

In your example, it looks like you have five “centers.” Build a gaussian
distribution for each of your five centers, generate a random integer from
0 to 4 (e.g., torch.multinomial()) and use that to choose which of your
five gaussian distributions to sample from. If appropriate, you can weight
your five distributions differently.

Note, it could end up being faster to generate your batch of five gaussian
variates and then throw four away by multiplying the vector of your five
gaussian variates with the one-hot version of your random integer.