我想训练一个带有自定义损失函数的模型,为此,我需要将张量转换为以下方法内的numpy数组:
def median_loss_estimation(y_true, y_predicted):
a = y_predicted.numpy()
但是我有这个错误:
AttributeError: 'Tensor' object has no attribute 'numpy'
为什么?如何将张量转换为numpy数组?
答案是:把run_eagerly=True
在model.compile
!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句