以下代码在tensorflow r1.12的Python API中会产生警告:
#!/usr/bin/python3
import tensorflow as tf
M = tf.keras.models.Sequential();
M.add(tf.keras.layers.Dense(2));
完整的警告文本如下:
WARNING: Logging before flag parsing goes to stderr.
W0213 15:50:07.239809 140701996246848 deprecation.py:506] From /home/matias/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/init_ops.py:1253: calling VarianceScaling.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Call initializer instance with the dtype argument instead of passing it to the constructor
我尝试过不同的方法,比如在添加密集层前初始化并调用内核初始化程序,然后将其传递给 Dense 构造函数,但似乎没有改变任何东西。 这个警告是不可避免的吗? 如果答案是“是”,那对我来说就足够了。