I have been trying to implement the softmax version of the triplet loss in Caffe described in  

[Hoffer and Ailon, *Deep Metric Learning Using Triplet Network*, ICLR 2015](http://arxiv.org/pdf/1412.6622v3.pdf).

I have tried this but I am finding it hard to calculate the gradient as the L2 in exponent is not squared. 

Can someone please help me here?