I’m new in PyTorch. I am trying to write a function that adds some arbitrary Gaussian noise to the wights during the training process. my code is like this
for m in model.modules():
if hasattr(m, ‘weight’):
m.weight.add_(np.random.normal(my_mean, my_std, m.shape)*noise_strength)
and my question is the shape of “m” how can I create noise with its shape?
I’m confused how should I do that, any help would be appreciated.