Sorry about post so simple question, I’m a freshman with PyTorch.
I need to normalize a feature tensor at inference stage.
Every average and STD values of every columns have been calculated already when training.
Now I get a row of new data to be inferred, and I need to normalize them at first.
But the shape of input is difference to the average tensor(same for STD), I can’t finger it out how to make that.
The average tensor is 1 dimension, and each element in it is for each column of the feature tensor in same order. The input has 2 dimensions.
avg = torch.rand(5) input = torch.rand(3, 5)
I know that can be done with a loop, but it’s not pythonic.
I guess that there must be a solution in vector way.
Further more, when the input has 3 dimensions, i.e. [batch_size, row_count, column_count], how do it?
avg = torch.rand(5) input = torch.rand(1, 3, 5)