I’d like to use TripletMarginLoss, but i like to modify the distance d with some custom fuction.
Can anyone please help and show me how I can rewrite the TripletMarginLoss in a way that i can modify the parts.
Looking at the source code it gets me to def triplet_margin_loss which is not that much useful either
Thanks for your answer.
I dont think you can write a normal python function and use it in pytorch. Unless they change it.
It has to be in pytorch to be able to do backpropagation.
Can you give me a simple example?
Sure. As I said, you can write a normal python function as long as you don’t break the pytorch magic i.e. do the calculations on tensors to not break the gradients.