Problem solved! Thanks! Just to make sure, if I want to define some new operations using either Pytorch or numpy, I need to work on autograd.Function layer; when I want to add some features to the existing functions (like adding noise to the linear operations), working on nn.Module layer should be enough. Is it correct?