1、项目场景:

在测试tensorflow安装是否成功时,出现以下问题,虽然不影响程序的运行,还是好奇的查了下解决办法。 “I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2 To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.”

2、原因分析:

报错代码:

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

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

表明 CPU 支持AVX AVX2 (可以加速CPU计算),但是你安装的 TensorFlow 版本不支持

3、解决方案:

1、可以忽略,或者加代码忽视这些问题。 2、如果想解决这个问题,可以卸载原来版本的tensorflow,安装cuda和cudnn和tensorflow对应的版本,链接地址:GPU对应cuda。 卸载使用命令如下:

pip uninstall tensorflow

完成后可以用pip list查看一下所有库,检查是否成功卸载。 安装tensorflow,进入anaconda创建的虚拟环境

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade tensorflow-gpu

查看原文