tensorflow bug集合

1、TypeError: __new__() got an unexpected keyword argument 'serialized_options'

原因:protobuf版本冲突

解决方法:

pip uninstall protobuf
pip install -U protobuf

参考资料:

https://blog.csdn.net/zxm1306192988/article/details/86545428

2、undefined symbol: cblas_gemm_s8u8s32_pack

解决方法:

conda remove mkl mkl-include
conda install numpy pyyaml mkl=2019.3 mkl-include setuptools cmake cffi typing

参考资料:

https://github.com/pytorch/pytorch/issues/18932

3、>>> import tensorflow as tf
ImportError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 967, in _find_and_load
SystemError: PyEval_EvalFrameEx returned a result with an error set
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
2019-04-21 12:09:51.936780: F tensorflow/python/lib/core/bfloat16.cc:675] Check
failed: PyBfloat16_Type.tp_base != nullptr

解决方法:

 pip install --user --upgrade numpy

参考资料:

https://blog.csdn.net/a6840231/article/details/88256524

4、OSError: libgfortran.so.3: cannot open shared object file: No such file or directory

conda install libgfortran==1

参考资料:

https://github.com/menpo/landmarkerio-server/issues/23

5、ValueError: Incompatible type conversion requested to type ‘float32’ for variable of type ‘int32_ref’

原因:初始化的时候,对变量未指定类型。

解决方案:

W = tf.Variable(tf.zeros([784, 10]), dtype=tf.float32)

6.AttributeError: module 'tensorflow.python.training.training' has no attribute 'get_or_create_global_step'

tensorflow1.10里面没有get_or_create_global_step接口,升级到1.12就好了:

pip install --upgrade tensorflow==1.12

7.PermissionDeniedError when save model

将设置的模型保存路径设置为相对路径,然后创建对应文件夹即可:

tf.app.flags.DEFINE_string("train_dir", "./cifar10_train",
                           """Directory where event logs """ \
                           """and checkpoints.""")

参考资料:

https://github.com/tensorflow/models/issues/2876

8.家里网被墙了,使用清华源下载

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

9.windows上Anaconda使用清华源

先使用如下命令生成.condarc文件

conda config --set show_channel_urls yes

.condarc文件路径为:

C:\Users\Administrator

用nodpad++打开,贴上如下内容:

channels:
  - defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

然后输入如下命令清空缓存,确保使用清华源镜像:

conda clean -i

参考资料:

https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

~~~未完待续~~~

你可能感兴趣的:(Tensorflow)