版本:

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. SpringBoot系列(四)使用spring-kafka实现生产者消费者demo代码

    一.引入spring-kafka的maven依赖 <dependency> <groupId>org.springframework.kafka</groupId> ...

  2. 如何监控文件变化,比如密码修改导致 shadow 文件变化

    原始需求是如果系统的密码被修改,或者创建了新用户,就告警出来.本质上,只需要监控 /etc/shadow 文件变化即可.但是在指标监控体系里,这个事情就比较棘手,只能把文件的 mtime 作为指标的值 ...

  3. html 适配iphone X 底部导航

    html 适配iphone X 底部导航 适配手机底部有横线的手机,以免被横线遮挡 padding-bottom: constant(safe-area-inset-bottom); /* 兼容 iO ...

  4. 多个if查询及case when 语句

    concat( if(t2.`flow_flag`=1 and t1.`field_source`= '06','支付宝账号1',''),if(t2.`flow_flag`=0 and t1.`fie ...

  5. c# 基础小知识备忘录

    记性不大好,记下来 First 和 FirstOrDefault  First方法:返回List集合序列中的第一个符合条件的元素,如果没有查找到,则抛出运行时异常. FirstOrDefault方法: ...

  6. (四)Redis 缓存应用、淘汰机制

    1.缓存应用 一个系统中不同层面数据访问速度不一样,以计算机为例,CPU.内存和磁盘这三层的访问速度从几十 ns 到 100ns,再到几 ms,性能的差异很大,如果每次 CPU 处理数据时都要到磁盘读 ...

  7. C++获取商店应用(msix应用)桌面快捷方式的安装目录

    传统应用的快捷方式目标指向可执行文件的路径,但是对于商店应用(也叫msix打包应用),则指向一个奇怪的字符串,使用IShellLink::GetPath获取路径时,则得到的是空字符串,而我们的最终目的 ...

  8. Linux C 读写超过2G的大文件 注意事项

    背景 在项目中做大文件的增量读写,遇到了问题: fopen : Value too large for defined data type. 习惯性地根据这个提示查阅的有关资料显示: 1)工具链太老了 ...

  9. ReST,以及RESTful的 简单介绍

    什么是 ReST 阮一峰说的比较清楚,具体见他的博客文章. 二.名称 ReST这个词,是[Roy Thomas Fielding](http://en.wikipedia.org/wiki/Roy_F ...

  10. Webpack5

    Webpack是一款模块打包工具,可以把多个文件打包成一个或几个文件,它不仅能打包JS文件, 还能打包css, image等静态资源.当然,在默认情况下,它只打包JS文件和JSON文件,因为它只认识J ...