def contrastive_loss_with_margin(margin):
    def contrastive_loss(y_true, y_pred):
        '''Contrastive loss from Hadsell-et-al.'06
        http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf
        '''
        square_pred = K.square(y_pred)
        margin_square = K.square(K.maximum(margin - y_pred, 0))
        return K.mean(y_true * square_pred + (1 - y_true) * margin_square)
    return contrastive_loss
i want to kown that when we pass the y_ture and y_pred parameter to the loss function, the y_true is refered to one sample data or otherwise refer to one batch data? because i see in the contrastive loss function, the teacher put the calculation K.mean() to generate the final loss. In my mind, y_true shape is (1,) which means the similarity between the two input pictures. But i am confused with the mean() here . is y_true shape is (None, 1)? None means batch size.
Thanks!