Imported from https://github.com/namdvt/Focal-loss-pytorch-implementation