InvalidArgumentError: assertion failed: [predictions must be >= 0] [Condition x >= y did not hold element-wise:] 在 Functional API 中使用 LSTM 时

问题描述

我的代码在 Epoch 5 之前运行得非常好,我看到了这条警告消息 (EmailMessage) 后跟错误

WARNING:tensorflow:Early stopping conditioned on metric `val_prc` which is not available. Available metrics are: loss,tp,fp,tn,fn,accuracy,precision,recall,auc,prc WARNING:tensorflow:Can save best model only with val_prc available,skipping.

这就是我的初始代码的样子。

InvalidArgumentError:  assertion Failed: [predictions must be >= 0] [Condition x >= y did not hold element-wise:] [x (model/output_layer/Sigmoid:0) = ] [[-nan][-nan][-nan]...] [y (metrics/tp/Cast_2/x:0) = ] [0]
     [[{{node metrics/tp/assert_greater_equal/Assert/AssertGuard/else/_270/Assert}}]] [Op:__inference_distributed_function_19774]

Function call stack:
distributed_function

我看过这个question。它不适用于我的情况,直到一个月前,我的代码曾经运行得非常好,没有任何错误或警告,我没有更改代码和数据中的任何内容。 我正在使用 Tensor-flow 版本 '2.1.3'

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)