版本:

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. C# .NET HttpWebRequest 按每个(单个)请求跳过证书校验

    C# .NET HttpWebRequest 按每个(单个)请求跳过证书校验 自签名证书 HTTPS TLS . 使用.NET 4.5 新加的属性 HttpWebRequest.ServerCerti ...

  2. Spring源码——AOP实现原理

    引言 Spring AOP(Aspect Orient Programming),AOP翻译过来就是面向切面编程,它体现的是一种编程思想,是对面向对象编程(OOP)的一种补充. 在实际业务开发过程中, ...

  3. resttemplate调用

    Map<String, Object> queryForHttp(String url, Map<String, Object> header, Map<String, ...

  4. 使用AWS Glue进行 ETL 工作

    数据湖 数据湖的产生是为了存储各种各样原始数据的大型仓库.这些数据根据需求,进行存取.处理.分析等.对于存储部分来说,开源版本常见的就是 hdfs.而各大云厂商也提供了各自的存储服务,如 Amazon ...

  5. Freertos学习:07-队列

    --- title: rtos-freertos-07-队列 EntryName : rtos-freertos-07 date: 2020-06-23 09:43:28 categories: ta ...

  6. QT学习:00 介绍

    --- title: framework-cpp-qt-00-介绍 date: 2020-04-08 15:41:54 categories: tags: - c/c++ - qt --- 章节描述: ...

  7. 五个节点的hadoop集群--主要配置文件

    五个节点:配置文件解析:hadoop01               NameNode .DataNode.NodeManagerhadoop02 ResourceManager hadoop03 D ...

  8. python 转换PDF 到 EPS

    from win32com.client.dynamic import ERRORS_BAD_CONTEXT as ebc from win32com.client import DispatchEx ...

  9. Linux相关知识备忘(随时更新)

    1.dpkg Debian Packager,Debian包管理器.可以方便的对软件进行安装更新和移除. (1)安装 dpkg -i xx.deb (2)卸载,但不删除配置文件 dpkg -r xx ...

  10. MySql创建事件、计划、定时运行

    CREATE EVENT IF NOT EXISTS check_timeout_eventON SCHEDULE EVERY 30 MINUTEDOBEGIN UPDATE safetyApp_in ...