See torch.nn.modules.loss — PyTorch 1.8.1 documentation 7 where classes _Loss and _WeightedLoss are protected and not getting imported in __init__.
What is the reason for this? For users who want to their own loss class it would be useful to both make use of the existing base classes and use them to better document the purpose of their own implementation as identifying them e.g. as a weighted loss.