我正在使用nosetests对我的Tensorflow代码进行单元测试,但它会产生如此冗长的输出,这使得它无用.
以下测试
import unittest
import tensorflow as tf
class MyTest(unittest.TestCase):
def test_creation(self):
self.assertEquals(True, False)
Run Code Online (Sandbox Code Playgroud)
运行时nosetests会产生大量无用的日志记录:
FAIL: test_creation (tests.test_tf.MyTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/cebrian/GIT/thesis-nilm/code/deepmodels/tests/test_tf.py", line 10, in test_creation
self.assertEquals(True, False)
AssertionError: True != False
-------------------- >> begin captured logging << --------------------
tensorflow: Level 1: Registering Const (<function _ConstantShape at 0x7f4379131c80>) in shape functions.
tensorflow: Level 1: Registering Assert (<function no_outputs at 0x7f43791319b0>) in shape functions.
tensorflow: Level 1: Registering Print (<function _PrintGrad at 0x7f4378effd70>) in gradient. …Run Code Online (Sandbox Code Playgroud) 我已经在Ubuntu 16.04上使用Cuda 9.0和CuDNN 7.0.5以及vanilla Python 2.7安装了TensorFlow 1.7,虽然他们的CUDA和CuDNN样本运行良好,而TensorFlow看到了GPU(因此运行了一些TensorFlow示例),那些使用CuDNN (像大多数CNN的例子一样)没有.他们失败了这些信息性消息:
2018-04-10 16:14:17.013026: I tensorflow/stream_executor/plugin_registry.cc:243] Selecting default DNN plugin, cuDNN
25428 2018-04-10 16:14:17.013100: E tensorflow/stream_executor/cuda/cuda_dnn.cc:403] could not create cudnn handle: CUDNN_STATUS_NOT_INITIALIZED
25429 2018-04-10 16:14:17.013119: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:369] driver version file contents: """NVRM version: NVIDIA UNIX x86_64 Kernel Module 384.130 Wed Mar 21 03:37:26 PDT 2018
25430 GCC version: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)
25431 """
25432 2018-04-10 16:14:17.013131: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:112] version string "384.130" made value 384.130.0
25433 2018-04-10 16:14:17.013135: E tensorflow/stream_executor/cuda/cuda_dnn.cc:411] possibly insufficient …Run Code Online (Sandbox Code Playgroud)