【发布时间】:2019-05-08 07:24:29
【问题描述】:
我正在尝试使用 def 'tf.losses.mean_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
谁能帮我解决这个问题?
【问题讨论】:
-
你应该包括完整的回溯,只是最后的错误没有说太多。
-
这个问题你解决了吗?
-
@AlbinDavid 抱歉,还没有
-
@Ashj 添加了对我有用的答案。
标签: python tensorflow loss-function reduction mean-square-error