Solved by albanD in post #2 
              
              
                Hi, 
Functions are used slightly differently compared to nn.Modules. 
Your code sample should be: 
a = Variable(torch.randn(4) + 10)
b = Variable(torch.randn(4) + 10)
# You never instantiate a `Function` yourself !
loss = GammaLoss.apply(a, b)
print(loss)

For convenience, you can use the following n…