21

I am using Keras to create a deep learning model. When I creating a VGG16 model, the model is created but I get the following warning.

vgg16_model = VGG16()

why this warning happens and how can I resolve this?

WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
desertnaut
  • 57,590
  • 26
  • 140
  • 166
Noran
  • 707
  • 1
  • 8
  • 19

3 Answers3

8

It looks like there's an open git issue to clean this up in the keras code:

https://github.com/tensorflow/minigo/issues/740

You should be safe to ignore the warning, I don't believe you can change it without modifying the TF repo. You can disable warnings as mentioned here:

tf.logging.set_verbosity(tf.logging.ERROR)
David Parks
  • 30,789
  • 47
  • 185
  • 328
1

You can use the function below to avoid these warnings. First, you must make the appropriate imports:

 import os
 os.environ['KERAS_BACKEND']='tensorflow'
 import tensorflow as tf


def tf_no_warning():
    """
    Make Tensorflow less verbose
    """
    try:

        tf.logging.set_verbosity(tf.logging.ERROR)
        os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'

    except ImportError:
        pass

And then call the above function at the beginning of the code.

 tf_no_warning()
Italo Gervasio
  • 358
  • 2
  • 5
-1

So , the method colocate_with is a context manager to make sure that the operation or tensor you're about to create will be placed on the same device the reference operation is on. But, your warning says that it will be deprecated and that this will from now on be handled automatically. From the next version of tensorflow, this method will be removed so you will either have to update your code now (which will run currently) or later (when you update the version of tensorflow to the next one, this code will no longer be runnable because that method will be removed)

Novak
  • 2,143
  • 1
  • 12
  • 22
  • I get the same Warning when I use TensorFlow's `fully_connected` function for creating layers of the network. How can I correct it? – Leevo Feb 20 '19 at 19:50