【发布时间】:2018-12-02 05:27:12
【问题描述】:
这是来自自定义 Keras 回调 casted=K.cast((yPred), K.tf.int32)
我绝对需要将 yPred(张量)转换为 int32 类型(转换应用于张量内容,我知道)
不过,K.cast 只允许转换为浮动。
我该如何解决这个问题?
【问题讨论】:
-
K.tf?你试过简单的“int32”吗?
-
你也试过K.round吗?
-
很抱歉,它有效。
-
@DanielMöller K.round 可能会返回一个浮点数。如果它要返回一个 int,我们仍然无法使用它。 Keras 不允许您在损失函数中放置 Round
标签: python tensorflow casting keras tensor