How to Suppress Tensorflow warning displayed in result [duplicate]

点点圈 提交于 2019-12-10 01:04:53

问题


I have a python code connected with Tensorflow. It is supposed to return single result set. But i'm getting below mentioned warning along with result.

WARNING:tensorflow:From C:\Users\vsureshx079451\AppData\Local\Programs\Python\Python36\lib\site-packages\tflearn\objectives.py:66: calling reduce_sum (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 2018-02-04 19:12:04.860370: I C:\tf_jenkins\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2

Result Here!

I will just put a small snippet of TensorFlow code here. Please let me know how to suppress this warning.

Note: I'm calling this Python file from C#. So i dont want to display anything other than result.

Code Snippet:

self.words = data['words']
        self.classes = data['classes']
        train_x = data['train_x']
        train_y = data['train_y']
        with open('intents.json') as json_data:
            self.intents = json.load(json_data)
        #input("Press Enter to continue...")
        tf.reset_default_graph()
        net = tflearn.input_data(shape=[None, len(train_x[0])])
        net = tflearn.fully_connected(net, 8)
        net = tflearn.fully_connected(net, 8)
        net = tflearn.fully_connected(net, len(train_y[0]), activation='softmax')
        net = tflearn.regression(net)
        # Define model and setup tensorboard
        self.model = tflearn.DNN(net, tensorboard_dir='tflearn_logs')

Edit: I tried this as well, it didn't work.

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

回答1:


After searching hours together i found answer from Stackoverflow itself, where the answer is provided for different issue. And that solution worked here as well.

Here is the solution:

tf.logging.set_verbosity(tf.logging.ERROR)

Source: Is there a way to suppress the messages TensorFlow prints?



来源:https://stackoverflow.com/questions/48608776/how-to-suppress-tensorflow-warning-displayed-in-result

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!