how initialize a torch of matrices
Hello I m trying to create a tensor that will have inside N matrices of n by n size. I tried to initialize it with
Q=torch.zeros(N, (n,n))

but i get the following error
zeros(): argument 'size' must be tuple of ints, but found element of type tuple at pos 2

Also I want to fill it later with random matrices with integer values and I will turn it to semidefinte so I thought of the following
for i in range(0,N):
   Q[i]=torch.randint(0,10,(n,n))
Q = Q*Q.t()

Is it correct? Is there any other faster way with a build in command?

N matrices of n x n size is equivalent to three dimensional tensor of shape [N, n, n]. You can do it like so:
import torch

N = 32
n = 10
tensor = torch.randint(0, 10, size=(N, n, n))

No need to fill it with zeros to begin with, you can create it directly.
You can also iterate over 0 dimension similar to what you did:
for i in range(0, N):
    tensor[i] = tensor[i] * tensor[i].T

See @Dishin H Goyani answer for faster approach with permutation.
