如何使用编译器标志重建张量流?

cha*_*god 18 python tensorflow

我正在尝试使用张量流后端运行二进制分类,但我不断收到错误,我认为该错误要求我使用正确的编译器标志重建张量流。我知道我的代码和数据是功能性的,所以我认为问题出在虚拟环境上。我尝试过在tensorflow的网站、ibm的网站、stackoverflow上寻找解决方案,但都没有成功。我也尝试过重新安装tensorflow和python。

完整回溯:

I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set

I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA

To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.

虚拟环境信息:

-使用anaconda环境

-Python 3.7.9

-张量流2.4.1

小智 25

我隐藏了这些警告:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
Run Code Online (Sandbox Code Playgroud)

请注意,这不会重建 TensorFlow,而只是隐藏警告。

您的 CPU 支持此 TensorFlow 二进制文件未编译为使用的指令:AVX AVX2

  • 这并没有解决“如何重建 Tensorflow”的问题,而只是隐藏了警告。这可能足以满足OP的要求,但这应该在答案中提及。 (5认同)
  • 同意@MichaelMior的观点,这并不能解决如何重建张量流的问题 (2认同)