Hi! I feel confused about the ‘class ContrastiveLoss’.
When I use the wrapper function in the assignment of course1-week1 ,it returns ’ (y_true * square_pred + (1 - y_true) * margin_square)’. there is no ‘k.mean’ .but I use the ‘k.mean(y_true * square_pred + (1 - y_true) * margin_square)’ it also OK, why?what’s the difference?
def contrastive_loss_with_margin(margin):
def contrastive_loss(y_true, y_pred):
…
return (y_true * square_pred + (1 - y_true) * margin_square)
return contrastive_loss
Is there any one telling me about it ? thanks a lot.