https://machinelearningmastery.com/creating-custom-layers-loss-functions-pytorch/