Is it possible to vectorize training process?

I have 50 respondents x 120 items and ratings given by them. I train my model with 3 for-loops:

for each epoch:
 for each respondent of 50
   for each item of 120
      # the label is rating of respondent i item j.
      # the label dimension would be [1, 1]

I was wondering if I can train the model like the following way:

for each epoch:
  for each item of 120:
   # the labels are ratings of 50 respondents item j.
   # the label dimension would be [50, 1]

Can pytorch realize this and optimize the neural network model? However, in this case, I am not sure how the model parameters will be updated.

It depends on your overall workflow and how the data is handled at the moment.
Generally, PyTorch modules accept a batched input (usually the batch dimension is in dim0).
If the “50 respondents” would be seen as a batch of 50 observations, you should be able to directly pass this input tensor to the model and calculate the loss.
By default the criterion will calculate the loss as the average of the sample losses.