tf2.0模型问题
H山鬼H
这个作者很懒,什么都没留下…
展开
-
tf.function-decorated function tried to create variables on non-first call
tf2.0在模型的call()中调用tf.keras.layers.embedding,出错tf.function-decorated function tried to create variables on non-first call解决方法:不要再call中调用tf.keras的接口,使其在模型定义的init()方法中定义。如`def __init__():self.embed_seq = tf.keras.layers.Embedding(8874, input_length.原创 2021-05-12 22:21:28 · 1075 阅读 · 0 评论 -
模型训练出错,predictions must be >=0
前几天用python处理了一下数据集,跑了一遍模型训练和预测都没有问题。然后又用scala跑了一份不同用户的数据集,想看一下scala跑出来的效果,结果出现了这个问题:assertion failed: [predictions must be >= 0] [Condition x >= y did not hold element-wise:x (my_model/Sigmoid:0) = ] [[-nan][-nan][-nan]…] [y (metrics/auc_1/Cast_1/x.原创 2020-12-05 13:49:23 · 1772 阅读 · 1 评论