No, as the derivative for weights is not implemented.
You could check it by passing a weights tensor using requires_grad=True, which will raise the exception:
RuntimeError: the derivative for 'weight' is not implemented

However, have a look at this implementation 134 of the focal loss.