【发布时间】:2023-01-16 17:06:47
【问题描述】:
升级到 tensorflow 2.9 后,我收到以下错误消息 调用 model.fit() 时 使用 tf 2.8 没有错误。 无论如何都适合,但令人担忧。
2022-06-21 12:42:58.930086: W tensorflow/core/common_runtime/forward_type_inference.cc:231] Type inference failed. This indicates an invalid graph that escaped type checking. Error message: INVALID_ARGUMENT: expected compatible input types, but input 1:
type_id: TFT_OPTIONAL
args {
type_id: TFT_PRODUCT
args {
type_id: TFT_TENSOR
args {
type_id: TFT_BOOL
}
}
}
is neither a subtype nor a supertype of the combined inputs preceding it:
type_id: TFT_OPTIONAL
args {
type_id: TFT_PRODUCT
args {
type_id: TFT_TENSOR
args {
type_id: TFT_LEGACY_VARIANT
}
}
}
while inferring type of node 'calculate/cond/output/_10'
知道什么会导致这个或如何解决它吗?
【问题讨论】:
-
你可以发布你的问题代码吗?只是错误消息本身有点含糊。
-
请分享一些最小的可重现代码以了解此错误。
-
不幸的是,我真的无法提供更多信息,因为我收到了以下代码的消息:self.train_model.fit(train_generator.get(), epochs=self.epochs, validation_data=val_generator.get(), callbacks=self.callbacks)对于不同的模型架构,我得到了相同的消息,因此很难减少搜索空间
-
我想我已经将范围缩小到 tf.train、tf.io 或 tf.data...我可能不得不重新编写用于保存 TFRecords 并再次加载它们的代码。希望它会更好,因为使用当前代码(在 2.2 上开发,升级到 2.4,现在试图升级到 2.9)需要一百万年才能保存任何东西。
-
有没有人找出这个错误的原因?
标签: tensorflow keras types upgrade