【发布时间】:2020-07-18 17:06:16
【问题描述】:
我想用自定义损失函数训练一个模型,为此,我需要在下面的方法中将张量转换为 numpy 数组:
def median_loss_estimation(y_true, y_predicted):
a = y_predicted.numpy()
但我有这个错误:
AttributeError: 'Tensor' object has no attribute 'numpy'
为什么? 如何将张量转换为 numpy 数组?
【问题讨论】:
标签: python numpy tensorflow loss-function loss