It might work, but TBH neither does the cast to long make sense to me nor do the large numbers.
The original intention of the triple loss was to have feature vectors from three examples where a and p are of the same class and n is of a different one 1. I don’t think having anchors live on a completely different scale than p and n makes much sense for that.