From the code you sent, your loss class is a subclass of nn.Module. As you can see in the doc you should only implement __init__ and forward and use it by calling it on inputs as:
mod = YourMod(init_args)
out = mod(input) # This will call .forward() + do other stuff needed by pytorch

The __call__ method is implemented on the base class and should not be override.
If you implement this method using only pytorch’s methods, the autograd will give you the gradients yes.