【发布时间】:2018-04-02 09:13:54
【问题描述】:
我想使用 keras 中定义的各种损失函数来手动计算损失值。例如:
from keras.losses import binary_crossentropy
error=binary_crossentropy([1,2,3,4],[6,7,8,9])
给我错误
AttributeError: 'list' object has no attribute 'dtype'.
我想使用其他 keras 损失函数的类似方式。我有我的 y_pred 和 y_true 列表/数组。
【问题讨论】:
-
使用 numpy 数组而不是列表
-
完成了,将我的列表转换为 numpy 数组,但我得到了这个
AttributeError: 'numpy.dtype' object has no attribute 'base_dtype'。
标签: python deep-learning keras