TensorFlow初学者常见错

一、Your CPU supports instructions that this TensorFlow binary was not compiled to use 
出现这个问题是为了提醒你提升CPU计算速度的,若我们已经有支持cuda的GPU,则可以忽略这个问题,因为安装SSE4.1,SSE4.2,AVX,AVX2,FMA,仅仅提升CPU的运算速度(大概有三倍)

解决方法:1、忽视警告,并屏蔽警告。开头输入:

                        import os

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

                2、进入tensorflow官网,从源码安装。

二、运行tensorflow测试程序时,出现:FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.

  from ._conv import register_converters as _register_converters

解决方法: 输入 pip install h5py==2.8.0rc1

三、SyntaxError: Missing parentheses in call to 'print'

出现这个问题是因为你使用的这段python demo和你电脑上安装的python版本不一致,一个是python2,一个是python3,改正方法就是改成配你电脑python的语法格式,如把print result 改为print(result)

四、出现IndentationError:expected an indented block错误

出现这个错误是因为Python语言对缩减非常敏感,出现这个错就说明此处需要缩进。

规律为:末尾有冒号的一行代码的下一行往往都需要缩进。

猜你喜欢

转载自blog.csdn.net/qq_25973779/article/details/80102537