Windows上的TensorFlow版本1.0.0-rc2:“OpKernel('op:”BestSplits“device_type:”CPU“')for unknown op:BestSplits”with test code

我在Windows 7 SP1 x64 Ultimate(Python 3.5.2 | Anaconda自定义(64位))上安装了TensorFlow 1.0.0-rc2版本,使用:

pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.0rc2-cp35-cp35m-win_amd64.whl 

当我尝试在Eclipse 4.5或控制台中从https://web.archive.org/web/20170214034751/https://www.tensorflow.org/get_started/os_setup#test_the_tensorflow_installation运行testing脚本时:

 import tensorflow as tf print('TensorFlow version: {0}'.format(tf.__version__)) hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print(sess.run(hello)) 

我得到一些错误信息:

 TensorFlow version: 1.0.0-rc2 'Hello, TensorFlow!' E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflob w\core\framework\op_kernel.cc:943] OpKernel ('op: "BestSplits" device_type: "CPU"') for unknown op: BestSplits E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "CountExtremelyRandomStats" device_type: "CPU"') for unknown op: CountExtremelyRandomStats E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "FinishedNodes" device_type: "CPU"') for unknown op: FinishedNodes E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "GrowTree" device_type: "CPU"') for unknown op: GrowTree E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "ReinterpretStringToFloat" device_type: "CPU"') for unknown op: ReinterpretStringToFloat E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "SampleInputs" device_type: "CPU"') for unknown op: SampleInputs E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "ScatterAddNdim" device_type: "CPU"') for unknown op: ScatterAddNdim E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TopNInsert" device_type: "CPU"') for unknown op: TopNInsert E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TopNRemove" device_type: "CPU"') for unknown op: TopNRemove E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TreePredictions" device_type: "CPU"') for unknown op: TreePredictions E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "UpdateFertileSlots" device_type: "CPU"') for unknown op: UpdateFertileSlots 

为什么?

我没有这样的问题与TensorFlow 0.12.1(安装pip install tensorflow==0.12.1 ):

 TensorFlow version: 0.12.1 b'Hello, TensorFlow!' 

安装今天晚上构build (CPU版本):

 pip install --upgrade http://ci.tensorflow.org/view/Nightly/job/nightly-win/85/DEVICE=cpu,OS=windows/artifact/cmake_build/tf_python/dist/tensorflow-1.0.0rc2-cp35-cp35m-win_amd64.whl 

修复了这个问题(没有更多的“OpKernel ('op: ”BestSplits“ device_type: ”CPU“') for unknown op: BestSplits”等)。

现在有一些SSE警告:

 TensorFlow version: 1.0.0-rc2 b'Hello, TensorFlow!' 2017-02-15 19:56:22.688266: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations. 2017-02-15 19:56:22.688266: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations. 2017-02-15 19:56:22.689266: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations. 2017-02-15 19:56:22.689266: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2017-02-15 19:56:22.689266: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2017-02-15 19:56:22.689266: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 

在这种情况下,您可以尝试如何使用SSE4.2和AVX指令编译Tensorflow?


TensorFlow 1.0.0是在几天前发布的。 但是,它也有同样的问题。 最近的一个夜晚版本有不同的警告 :

 sess = tf.Session() 2017-02-17 13:01:59.790943: W c:\tf_jenkins\home\workspace\nightly-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations. 

FYI: Tensorflow macOS二进制文件,使用SSE4.1,SSE4.2和AVX优化编译。


要隐藏警告/错误,可以使用 os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' ,例如:

 import tensorflow as tf import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' print('TensorFlow version: {0}'.format(tf.__version__)) hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print(sess.run(hello)) 

TF_CPP_MIN_LOG_LEVEL

  • 0 :显示所有日志(这是默认设置)
  • 1 :过滤掉INFO日志
  • 2 :另外过滤掉WARNING日志
  • 3 :另外过滤掉ERROR日志。

参考上面的build议,我认为做2个步骤是有帮助的:

1,升级tensorflow:

 pip install --upgrade tensorflow==1.1.0rc1 

然后,错误日志变成警告日志:

 W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations. 

第二,你可能会抑制2级的警告filter。

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

我认为没有过滤“错误”日志效果很好。

你也许能够抑制级别2的警告filter。在virtualenv安装中,这对于TensorFlow 1.0.1来说是有效的。

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

Sry有关额外的答案,但我不值得评论。

似乎问题在版本1.1.0rc0和更高版本中得到解决。

查找tensorflow的最新版本:

 pip search --version tensorflow 

升级tensorflow:

 pip install --upgrade tensorflow==1.1.0rc1