I need to find a way to use a non-pytorch loss function on a pytorch model. For reasons I will not go into it would be extremely cumbersome to rewrite this loss function in