Implement the triplet ranking hinge loss layer