Thanks for the info regarding the shapes!
Could you try the following code and see, if it’s working:
batch_size = 32
hidden= 4
nb_samples = 1000

output = torch.zeros(batch_size, nb_samples, hidden)
for i in range(nb_samples):
    output[:, i:i+1, :] = torch.randn(batch_size, 1, hidden)