This module will have its trainable parameters. The backward gradient depend on the parameters. Does torch.autograd.Function support trainable prameters?
i.e. can I have torch.nn.Parameter(…) in torch.autograd.Function?
An nn.Module can be seen as a container of parameters, calling in a forward method a list of operation processed on an input which are derivable wrt the parameters.
I am not sure to understand what you want to do, but if you define an autograd.Function like this: