问题描述
示例代码
model = tf.keras.Sequential()
# Adds a densely-connected layer with 64 units to the model:
model.add(layers.Dense(64, activation='relu'))
# Add another:
model.add(layers.Dense(64, activation='relu'))
# Add a softmax layer with 10 output units:
model.add(layers.Dense(10, activation='softmax'))
在官方 Tensorflow网站中会在该页面中显示警告本身.
in the official Tensorflow website results in a warning in the output as seen in that page itself.
calling VarianceScaling.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
警告的原因是什么?应该如何更改代码以避免此类警告?
What is the reason of the warning? How should the code be changed to avoid such warnings?
推荐答案
欢迎来到俱乐部:)我的意思是,tensorflow因不向后兼容而臭名昭著,更糟糕的是,很长一段时间以来都出现了这样的警告.
Welcome to the club :) I mean tensorflow is notorious for not being backward compatible and worse yet there are warnings like this now for a long time.
请参阅此处: https://github.com/tensorflow/tensorflow/issues/25996
因此,最好的选择就是忽略这些警告,并且,如果您希望主动,那就贡献一份解决方案.否则,请确保它们不会使您分心于主要任务.现在,警告在张量流中是正常的.
So your best bet is just ignore those warnings and, if you wish to be proactive, then contribute with a fix. Otherwise, make sure they do not distract you from your main task. Warnings now are normal in tensorflow.
这篇关于Tensorflow Keras官方教程中的折旧警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!