Is there a faster way than accumulating a 2d list (the program is given 1 row at a time), then converting the whole list all at once to a PyTorch Tensor? Is using torch.cat or torch.stack (converting each row to a Tensor first) more efficient?

This is to be inputted into a neural network, so the rows should be adjacent in memory.