This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Contrastive Loss | |
# by Che-Wei Lin | |
# Under the Simplified BSD License | |
import tensorflow as tf | |
from tensorflow.python.framework.function import Defun | |
def contrastive_loss(margin, threshold=1e-5): | |
"""Contrastive loss: |