I have TensorFlow 1.4.0 and Keras 2.1.2. When I'm trying to execute this code
...
model = Sequential()
model.add(Conv2D(32, (3, 3), padding='same',
input_shape=(IMG_ROWS, IMG_COLS, IMG_CHANNELS)))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.25))
model.add(Flatten())
model.add(Dense(512))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(NB_CLASSES))
model.add(Activation('softmax'))
model.summary()
...
I get the message:
WARNING:tensorflow:From /usr/local/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:1264: calling reduce_prod (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.
Instructions for updating:
keep_dims is deprecated, use keepdims instead
Could you fix it?
Please make sure that the boxes below are checked before you submit your issue. If your issue is an implementation question, please ask your question on StackOverflow or join the Keras Slack channel and ask there instead of filing a GitHub issue.
Thank you!
[ ] Check that you are up-to-date with the master branch of Keras. You can update with:
pip install git+git://github.com/fchollet/keras.git --upgrade --no-deps
[X] If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.
[ ] If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with:
pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
[ ] Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).
Yeah - I'm running into this too (TensorFlow 1.4.0)
so what's the solution?
Include this line in your code. It will ignore the error.
tf.logging.set_verbosity(tf.logging.ERROR)
where to include this line in code
You can use this code at the top of the main.py:
`def warn(args, *kwargs):
pass
import warnings
warnings.warn = warn
Closing this issue since PR has been merged to solve the original issue and also a work around is provided to suppress warning messages. Feel free to reopen if the problem still persists. Thanks!
This workaround works for me, thanks @ykpgrr
import sys
stdout = sys.stdout
sys.stdout = open('/dev/null', 'w')
import keras
sys.stdout = stdout
stderr = sys.stderr
sys.stderr = open(os.devnull, 'w')
import keras
sys.stderr = stderr
Most helpful comment
Include this line in your code. It will ignore the error.
tf.logging.set_verbosity(tf.logging.ERROR)