Is it possible to modify functions in a forward call?

Just like we can access a network’s modules using net._modules and then use that to modify the modules, change or remove them, can we do the same with the function calls defined in forward function?

For example, if we have a line out = out>0 in the forward call can we access this in any way (maybe with the new jit mechanisms) and change it to out = out > 0.1?

If you want to access an operation into the method of an object, as far as I know, it’s impossible on the whole python language. You can just access the parameters and methods of the object. But you can still re-define the whole forward method by inheritance.

1 Like