Solved by KFrank in post #5 
              
              
                Hi Aerys! 

I didn’t look at the github code you linked to, but, in general, if you 
have a (properly-written) torch.nn.Module or 
torch.autograd.Function, you can instantiate it “on the fly” and 
call it, rather than using it as a “layer” in a model. 
Thus, for example: 
probs = torch.nn.Softmax (d…