成功解决Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2「建议收藏」

成功解决Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2「建议收藏」解决问题在导入tensorflow后,进行运算时,出现了红色错误!importtensorflowastfimportnumpyasnp资料参考AdvancedVectorExtensions(AVX,alsoknownasSandyBridgeNewExtensions)先进的矢量扩展(AVX,也称为桑迪桥新的扩展)是从英特尔和英特…

大家好,又见面了,我是你们的朋友全栈君。

解决问题

在导入tensorflow后,进行运算时,出现了红色错误!

import tensorflow as tf

import numpy as np

成功解决Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2「建议收藏」

资料参考

Advanced Vector Extensions (AVX, also known as Sandy Bridge New Extensions) 先进的矢量扩展(AVX,也称为桑迪桥新的扩展)是从英特尔和英特尔在2008年3月提出的微处理器的X86指令集架构的扩展,第一次由英特尔支持,在第2011季度和以后的SoeBoE桥处理器装运。AMD与推土机处理器航运在Q3 2011。AVX提供了新的特性、新的指令和新的编码方案。AVX2将大多数整数命令扩展为256位,并介绍了融合乘法累加(FMA)操作。AVX-512扩展AVX到512位支持使用一个新的EVEX前缀编码由英特尔提出的2013年7月,第一次支持英特尔与骑士着陆处理器,在2016装运。

成功解决Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2「建议收藏」

成功解决Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2「建议收藏」

成功解决Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2「建议收藏」

import os  
os.environ["TF_CPP_MIN_LOG_LEVEL"]='1' # 这是默认的显示等级,显示所有信息  
os.environ["TF_CPP_MIN_LOG_LEVEL"]='2' # 只显示 warning 和 Error   
os.environ["TF_CPP_MIN_LOG_LEVEL"]='3' # 只显示 Error  

思路分析

参考网友的评论解释:这个意思其实是,您下载的TensorFlow太low了,根本没有通过兼容AVX来Compile。如果您下载源代码在该电脑上重新compile,就可以支持AVX。其实你的电脑是支持AVX的,只是编译好的TensorFlow不支持。

网友分析比较正确请参考理解

1、第一位网友

https://github.com/lakshayg/tensorflow-build 这有别人编译好的
成功解决Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2「建议收藏」

2、第二位网友
成功解决Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2「建议收藏」

解决办法

在最顶行写入

import os
os.environ[‘TF_CPP_MIN_LOG_LEVEL’] = ‘2’

成功解决Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2「建议收藏」

此方法,可以临时屏蔽警告信息,看起来舒服了一些。如果网友们,有更好的解决办法,群策群力,请留言探讨,共同学习!

代码如下:

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

import tensorflow as tf
sess=tf.Session()
a=tf.constant(1)
b=tf.constant(3)
print(sess.run(a+b))
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/139001.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号