我正在尝试使用def‘tf.losses.means_squared_error’。但我得到了
NameError: name 'Reduction' is not defined我正在使用TF 1.13。是否存在某些导入问题,或者tf.losses.mean_squared_error函数是否有任何更新?
我的代码如下。
def reg_loss(pred, GT):
loss = tf.losses.mean_squared_error(
labels = GT,
predictions = pred,
weights=1.0,
scope=None,
loss_collection=tf.GraphKeys.LOSSES,
reduction=Reduction.SUM_BY_NONZERO_WEIGHTS)
return reg_loss有人能帮我解决这个问题吗?
发布于 2019-11-21 14:26:04
使用tf.losses.Reduction.SUM_BY_NONZERO_WEIGHTS解决了我的问题。
https://stackoverflow.com/questions/56035572
复制相似问题