def get_metric():
def return_metric():
import keras.backend as K
def cosine_proximity(y_true, y_pred):
y_true = K.l2_normalize(y_true, axis=-1)
y_pred = K.l2_normalize(y_pred, axis=-1)
return -K.mean(y_true * y_pred)
return cosine_proximity
return return_metric
评论列表
文章目录