keras中的自定义损失函数返回nan损失

时间:2018-10-29 19:41:41

标签: python python-3.x tensorflow keras loss-function

以下是我在喀拉拉邦的自定义损失函数。   y_truey_pred的形状均为(256,384,3)

def myloss(y_true,y_pred):
    diff = y_pred - y_true
    diff = diff[96:160 , 144:240]
    return K.mean(K.square(diff), axis=-1)

在这里,我将部分差异切成薄片,并为此找到mean_square_loss。但是,此函数返回nan作为损失。为什么会这样?

0 个答案:

没有答案
相关问题