How should I calculate accuracy of triplet neural network in pytorch?

hello all
I found the following link, a way to calculate the accuracy of the triplet network. Is that the only way to obtain the accuracy in the mentioned network?
thanks
https://github.com/andreasveit/triplet-network-pytorch/blob/14e64764ec33d0a6e54508cee24ef7e7fe3a8366/train.py#L251