Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WARNING:tensorflow with constraint is deprecated and will be removed in a future version

I am following Tensorflow's tutorial on building a simple neural network, and after importing the necessary libraries (tensorflow, keras, numpy & matplotlib) and datasets (fashion_mnist) I ran this code as per the tutorial:

model = keras.Sequential([
    keras.layers.Flatten(input_shape=(28, 28)),
    keras.layers.Dense(128, activation='relu'),
    keras.layers.Dense(10, activation='softmax')
]) 

after running this code i received this warning message:

WARNING:tensorflow:From /Applications/anaconda3/envs/tensorfloe/lib/python3.7/site-packages/tensorflow_core/python/ops/resource_variable_ops.py:1630: calling BaseResourceVariable.init (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version. Instructions for updating: If using Keras pass *_constraint arguments to layers.

How do i fix this? Your help is highly appreciated.

like image 281
Fikile Avatar asked Feb 08 '20 19:02

Fikile


2 Answers

This is internal TensorFlow message, you can safely ignore it. It will be gone in future versions of TensorFlow, no actions from your side is needed.

like image 102
Vladimir Sotnikov Avatar answered Sep 28 '22 00:09

Vladimir Sotnikov


I had a similar warning when I was using tf.compat.v1.get_variable(...) and what I needed to do was to set the use_resource argument to False. Might help someone looking for a similar warning but doesn't look like the case with you though.

like image 23
Piyush Kansal Avatar answered Sep 27 '22 23:09

Piyush Kansal