
学号:19131213373
【嵌牛导读】tensor flow是用来实现mnist手写数字识别的一个库,但是运行时也会存在各种问题,在这里,为大家分享一下自己在学习过程中遇到的问题以及解决办法。
【嵌牛鼻子】python,tensor flow, warning
【嵌牛正文】
tensor flow是用来实现mnist手写数字识别的一个库,但是运行时也会存在各种问题,在这里,为大家分享一下自己在学习过程中遇到的问题以及解决办法。
跑tensorflow时报下面的warning:
2019-11-22 11:00:31.504004: W 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.
2019-11-22 11:00:31.504312: W 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.
2019-11-22 11:00:31.504325: W tensorflow/core/platform/cpu_feature_guard.cc:45]The TensorFlow library wasn't compiled to use AVX2 instructions,but these are available on your machine and could speed up CPU computations.
2019-11-22 11:00:31.504335: W tensorflow/core/platform/cpu_feature_guard.cc:45]The TensorFlow library wasn't compiled to use FMA instructions,but these are available on your machine and could speed up CPU computations.
解决办法:
Visual C++ 中的 Warning 警告类型错误有很多种。例如:(1)、虽然定义了某个变量,但是没有对其是否成功初始化就使用、(2)、把赋值符号的等于(=)写成了逻辑相等(==),等等。所以你必须要把详细的源代码写出来,别人才能够帮助你进行分析。例如对于(1)而言:
#include <stdlib.h>/* malloc( ) 函数原型在此头文件中定义 */
void main( )
{
char * p
p = (char *)malloc(10000)*sizeof(char) /* 为指针变量 p 动态分配内存 */
if( p == NULL ) /* 内存分配失败,返回 NULL */
{ /* 该段代码用于判断是否为指针变量 p 成功分配到内存,是必不可少的 */
printf("Memory allocation failured !\n")
exit(1) /* 若内存分配失败,退出应用程序,否则的话,严重的话,就有可能使系统崩溃!!! */
}
strcpy(p, "This is a test string") /* 内存分配成功,将字符串的内容复制到 p 中 */
}
例如:再对于(2)而言:
void main( )
{
int num
scanf("%d", &num)
if( num == 10 )
printf("You input number is: 10 !\n" )
else
printf("You input number is not 10 !\n" )
}
但是如果在这个程序中,把双等号:== 误写成了:=,那么该语句就变成了:if( num = 10 )
那么该语句产生的效果就是:无论你在 scanf( ) 语句中输入任何数字(任意的正数也好、负数也好),程序总是把 10 这个整数赋给变量 num,那么其逻辑表达式的值总为:1,所以则该程序的运行结果总是:You input number is: 10。
像这样的程序错误都属于 Warning 错误,在编译的时候是发现不了的,只有到运行程序的时候,才会发现程序的运行结果不正确。所以我在前面强调你必须要把详细的源代码写出来,别人才能够帮助你进行分析。
很简单,warning提示的也很明了,数据在从double转换为float过程可能会发生精度损失。解决方法:
1、float
function(float
x)
改为
float
function(double
x)
2、printf("%f\n",function(0.13))
改为printf("%f\n",function(0.13f))
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)