版本:

Python=3.7

TensorFlow=1.14

具体代码:

    init=[tf.global_variables_initializer(), tf.local_variables_initializer()]

    # train optimization
trainer = tf.train.AdamOptimizer(learning_rate=0.00001, beta1=0.9, beta2=0.999).minimize(train_loss)

报错:   Attempting to use uninitialized value beta2_power

查找资料:

https://stackoverflow.com/questions/47765595/tensorflow-attempting-to-use-uninitialized-value-beta1-power

得知,  优化器  trainer = tf.train.AdamOptimizer(learning_rate=0.00001, beta1=0.9, beta2=0.999).minimize(train_loss)

需要 局部变量,即 tf.local_variables  ,  在使用该优化器时需要在定义优化器之前定义对局部变量初始化的操作。

将原代码改为:

    # train optimization
trainer = tf.train.AdamOptimizer(learning_rate=0.00001, beta1=0.9, beta2=0.999).minimize(train_loss) init=[tf.global_variables_initializer(), tf.local_variables_initializer()]

代码可正常运行,报错问题解决。

-------------------------------------------------------------------------------

Attempting to use uninitialized value beta2_power -------TensorFlow报错的更多相关文章

  1. import tensorflow 报错: tf.estimator package not installed.

    import tensorflow 报错: tf.estimator package not installed. 解决方案1: 安装 pip install tensorflow-estimator ...

  2. 【python】python安装tensorflow报错:python No matching distribution found for tensorflow==1.12.0

    python安装tensorflow报错:python No matching distribution found for tensorflow==1.12.0 python版本是3.7.2 要安装 ...

  3. 1.Anaconda安装Tensorflow报错UnicodeDecodeError: 'utf-8' codec can't decode ## invalid start byte的问题之解决

    安装TensorFlow pip install --ignore-installed --upgrade tensorflow 报错: UnicodeDecodeError: 'utf-8' cod ...

  4. ubuntu 16.04 anaconda 4.2.0 安装tensorflow 报错

    ubuntu 16.04 anaconda 4.2.0 安装tensorflow 报错. 安装pyenv后,在pyenv环境内安装 anaconda,然后再安装tensorflow不再报错,比较奇怪, ...

  5. tensorflow报错:Attempting to fetch value instead of handling error Internal: failed to get device attribute 13 for device 0: CUDA_ERROR_UNKNOWN:

    就是在spyder跑上一篇文章的代码然后就报错: Attempting to fetch value instead of handling error Internal: failed to get ...

  6. 导入TensorFlow报错

    C:\....\Anaconda3\envs\py35\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the ...

  7. Tensorflow 报错:tensorflow.python.framework.errors_impl.InternalError: Failed to create session.

    问题描述 IDE:pycharm,环境中安装tensorflow-gpu 1.8.0 ,Cuda9 ,cudnn 7,等,运行代码 报错如下 tensorflow.python.framework.e ...

  8. ubuntu下tensorflow 报错 libcusolver.so.8.0: cannot open shared object file: No such file or directory

    解决方法1. 在终端执行: export LD_LIBRARY_PATH=”$LD_LIBRARY_PATH:/usr/local/cuda/lib64” export CUDA_HOME=/usr/ ...

  9. Windows下安装Tensorflow报错 “DLL load failed:找不到指定的模块"

    Windows下安装完tensorflow后,在cmd下运行python后import tensorflow出现如下错误: Traceback (most recent call last):  Fi ...

  10. import tensorflow 报错,CentOS 升级 glibc

    问题描述: ]: import tensorflow as tf ImportError: /lib64/libc.so.: version `GLIBC_2.' not found (require ...

随机推荐

  1. 反外挂 DDos UDP 攻击只需客户端 开着游戏客户端

    #include<WINSOCK2.H> #include<iostream> #include<string> using namespace std; #inc ...

  2. CentOS 7- 配置阿里镜像源

    1.备份CentOS 7系统自带yum源配置文件/etc/yum.repos.d/CentOS-Base.repo命令: mv /etc/yum.repos.d/CentOS-Base.repo /e ...

  3. C#字符串截取分割方法

    字符串操作:分割 Split.连接数组 Join.拼接 Format.截取 Substring.替换 Replace.左填充 PadLeft.右填充 PadRight.删除 Remove 1 //分割 ...

  4. 面试官:为什么重写equals方法必须要重新hashCode方法?

    网络上解释的很全面但是很枯涩,也有些难懂,其实就是为了保证当该对象作为key时哈希表的检索效率.如HashMap的get方法是分两步获取的 第一步通过key的哈希值找到对应的哈希桶 第二步通过equa ...

  5. Python数据类型(数字,字符串,[列表],(元组),{字典:字典值},{列表,列表2})

    Python数据类型(数字,字符串,[列表],(元组),{字典:字典值},{列表,列表2}) # 1. # Python3 数字(Number) # Python 数字数据类型用于存储数值. # 数据 ...

  6. 【Java异常】Variable used in lambda expression should be final or effectively final

    [Java异常]Variable used in lambda expression should be final or effectively final 从字面上来理解这句话,意思是:*lamb ...

  7. xxlJob Cron表达式 0 0 8,13 * * ?

    xxlJob Cron表达式  0 0 8,13 * * ? Cron有如下两种语法格式:(1)Seconds Minutes Hours DayofMonth Month DayofWeek Yea ...

  8. 简单的css3头像旋转与3D旋转效果

    Tips:当你看到这个提示的时候,说明当前的文章是由原emlog博客系统搬迁至此的,文章发布时间已过于久远,编排和内容不一定完整,还请谅解` 简单的css3头像旋转与3D旋转效果 日期:2017-7- ...

  9. 【iOS】自定义CALayer可能会出现没有动画过程但有动画结果的解析

    按照计划是要做成这样的动画 可是结果变成了这样 (有时候最重要的不是结果而是过程,日常鸡汤) 结果没有问题说明delegate中- (void)animationDidStop:(CAAnimatio ...

  10. Zynq-7000 AP SoC Boot - Multiboot Tech Tip

    背景 产品需要用到这个技术,在wiki找到了这篇文章. 创建者Confluence Wiki Admin Sep 24, 2018 in Xilinx-wiki Table of Contents D ...