版本:

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. 未能加载文件或程序集“SissPayWebApi”或它的某一个依赖项。试图加载格式不正确

    "未能加载文件或程序集"xxx"或它的某一个依赖项.试图加载格式不正确的程序."这个错误可能在IIS或VS中出现,一般是平台和dll版本不一致导致的. 一.VS ...

  2. 解决TypeError: 'NoneType' object is not subscriptable

    1.捕获异常的方式try: img_list = img_list["name"]except: img_list = "" 2.对象进行判断if img_li ...

  3. Imdeploy笔记

    Smiling & Weeping ---- 天气不好的时候,我会小心地把自己心上的裂缝补起来.为什么?... LMDeploy 的量化和部署 1 环境配置 2 服务部署 2.1 模型转换 2 ...

  4. FFmpeg开发笔记全目录(FFmpeg开发实战详解,含直播系统的搭建过程)

    ​记录下FFmpeg的学习笔记目录,完整的FFmpeg开发实战内容详见<FFmpeg开发实战:从零基础到短视频上线>一书. 下面是补充的FFmpeg开发笔记内容目录,主要是对<FFm ...

  5. Spring之WebMvcConfigurationSupport

    WebMvcConfigurationSupport是mvc的核心配置.开发spring,了解和掌握这个是必须的. 为了简约篇幅,本文把"WebMvcConfigurationSupport ...

  6. Unity中指定相机截屏,并将图片转为Base64

    问题背景: 需求就是只截场景,不包含UI,并将截图保存为Base64格式给到Web展示. 方案: 指定相机截图: 1 /// <summary> 2 /// 指定相机截屏 3 /// &l ...

  7. 重复消费Java Stream的三种方法。你选择哪种?

    Java中的Stream一旦被消费就会关闭,不能再次使用了.如果的确有需要该怎么办呢? 这里介绍三种重复消费Stream的方法. 1. 从集合再次创建 这里你都不用往下继续看就知道该怎么办,不过我还是 ...

  8. 算法金 | 推导式、生成器、向量化、map、filter、reduce、itertools,再见 for 循环

    大侠幸会,在下全网同名「算法金」 0 基础转 AI 上岸,多个算法赛 Top 「日更万日,让更多人享受智能乐趣」 不要轻易使用 For 循环 For 循环,老铁们在编程中经常用到的一个基本结构,特别是 ...

  9. 开源GTKSystem.Windows.Forms框架让C# winform支持跨平台运行

    目录 一.简介 二.GTKSystem.Windows.Forms框架的优势 三.支持界面皮肤主题定制 四.多种控件支持 五.支持Dock.Anchor.SplitContainer布局缩放 六.支持 ...

  10. 全网最适合入门的面向对象编程教程:11 类和对象的Python实现-子类调用父类方法-模拟串口传感器和主机

    全网最适合入门的面向对象编程教程:11 类和对象的 Python 实现-子类调用父类方法-模拟串口传感器和主机 摘要: 本节课,我们主要讲解了在 Python 类的继承中子类如何进行初始化.调用父类的 ...