How to apply gradient to tuneable gamma parameter in loss function

You can find an PyTorch implementation for such a loss in this thread.