pytorch batch training to achieve the principle: For example, I enter the training data is some one_hot vector, each batch_size = 5, that is, each time you enter five such vectors to the neural network, this time training neural network on these five data Is it read in one by one? Or all read into training.


I want to implement a single 2-norm normalization for each dimension.
Python code:
""“Normalization.”""
x = x / x.norm (dim = -1) [:, None]


The codes above shows my questions: Variable “x” and “x.norm” does not match, and result informs “RuntimeError: inconsistent tensor size”.
Thanks for your reading and I hope for your advice.