(EDITED)
For a custom autograd function, the backward step has to return as many gradients as the number of inputs in the forward function…
class MyLoss(torch.autograd.Function):  
    @staticmethod
    def forward(ctx, y_pred, y, a, b, c):
        ctx.save_for_backward(y, y_pred)
        return (y_pred - y).pow(2).sum() * a * b * c

    @staticmethod
    def backward(ctx, grad_output):
        yy, yy_pred = ctx.saved_tensors
        return torch.neg(2.0*(yy_pred - yy)), None, None, None, None ## corresponds to y, a, b, c

You need to return the same number of inputs in the backward step since this is what autograd is expecting even though it’s not going to be used …
For Documentation:

I found the tutorial 34 helpful (autograd section)
Extending Pytorch 13
Source code for torch.autograd.function 8

Automatic differentiation package 14 - has more details.

I hope you find that helpful …