首页 > 解决方案 > 如何使用编译器标志重建 tensorflow?

问题描述

我正在尝试使用 tensorflow 后端运行二进制分类,但我一直收到一个错误,我认为该错误要求我使用正确的编译器标志重建 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

标签: pythontensorflow

解决方案


我解决了:

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

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


推荐阅读