【问题标题】:TensorFlow version 1.0.0-rc2 on Windows: "OpKernel ('op: "BestSplits" device_type: "CPU"') for unknown op: BestSplits" with test codeWindows 上的 TensorFlow 版本 1.0.0-rc2:带有测试代码的“OpKernel ('op: "BestSplits" device_type: "CPU"') for unknown op: BestSplits"
【发布时间】:2017-07-02 05:37:01
【问题描述】:

我在 Windows 7 SP1 x64 Ultimate (Python 3.5.2 |Anaconda custom (64-bit)) 上安装了 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 运行测试脚本时:

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!'

【问题讨论】:

标签: python tensorflow


【解决方案1】:

安装today's nightly 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.

这种情况你可以试试How to compile Tensorflow with SSE4.2 and AVX instructions?


TensorFlow 1.0.0 几天前发布了。但是,它有同样的问题。最近的夜间版本有different warnings

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.

仅供参考:Tensorflow macOS binary, compiled with SSE4.1, SSE4.2 and AVX optimizations.


要隐藏警告/错误,您可以use 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 日志。

【讨论】:

  • 我可以确认我的机器上也发生了这种情况,正如这里描述的那样。我从print(sess.run(x)) 得到了一个干净的打印结果,但是在创建会话sess = tf.Session() 时我得到了同样的错误。
  • @Franck Dernoncourt 我已经在 window10 上安装了 tensorflow 的 gpu 版本并且遇到了同样的问题。上述解决方案是否也适用于我的情况?我担心的是在我已经安装了gpu版本tf的系统上安装cpu版本tf可以吗?
  • @julypraise 你安装了 TensorFlow-GPU nightly build 吗?
  • @FranckDernoncourt 不,我只安装了官方网站提供的“TensorFlow-GPU”。也就是说,我使用'pip3 install --upgrade tensorflow-gpu'安装了这个,因为这个命令是由官方网站提供的。所以你是建议我通过'ci.tensorflow.org/view/Nightly/job/nightly-win/…'安装,这似乎是你的意思?
  • @julypraise 是的,但请记住,这些警告/错误是无害的,因此在实践中我们可以忽略它们。
【解决方案2】:

参考上面的建议,我认为做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 级抑制警告过滤器。

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

我认为它在不过滤“错误”日志的情况下效果很好。

【讨论】:

  • 随着版本出现另一个警告。
【解决方案3】:

似乎问题在 1.1.0rc0 及更高版本中已修复。

找到最新版本的tensorflow:

pip search --version tensorflow

升级张量流:

pip install --upgrade tensorflow==1.1.0rc1

【讨论】:

    【解决方案4】:

    您可以在第 2 级抑制警告过滤器。这对我在 virtualenv 安装中使用 TensorFlow 1.0.1 有效。

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

    对额外的答案感到抱歉,但我不值得评论。

    【讨论】:

    • 我仍然在 TensorFlow 1.0.1 中遇到级别 2 的错误
    猜你喜欢
    • 2017-02-06
    • 1970-01-01
    • 1970-01-01
    • 2018-05-18
    相关资源
    最近更新 更多