Differences between F.relu(X) and torch.max(X, 0)
I am trying to implement the following loss function



To me, the most straight forword implementation would be using torch.max

losses = torch.max(ap_distances - an_distances + margin, torch.Tensor([0]))


However, I saw other implementations on github using F.relu

losses = F.relu(ap_distances - an_distances + margin)


They give essential the same output, but I wonder if there's any fundamental difference between the two methods.

torch.max is not differentiable according to this discussion.
A loss function needs to be continuous and differentiable to do backprop. relu is differentiable as it can be approximated and hence the use of it in a loss function. 
