Attempting to use uninitialized value beta2_power -------TensorFlow报错
报错 to value Tensorflow use POWER ------- attempting
2023-09-11 14:19:19 时间
版本:
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
查找资料:
得知, 优化器 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()]
代码可正常运行,报错问题解决。
-------------------------------------------------------------------------------
相关文章
- 《ASP.NET1200例》解决母版页报错“内容控件必须是内容页中的顶级控件,或是引用母版页的嵌套母版页。”
- php7-soap调用wsdl接口报错:Could not connect to host
- IDEA的SonarLint插件报错Unable to create symbol table for
- CentOS报错:Could not retrieve mirrorlist http://mirrorlist.centos.org
- vue路由报错Navigating to current location (“/login“) is not allowed踩坑总结
- 在vue里运行报错:Failed to resolve loader: sass-loader You may need to install it.提示需要安装sass模块
- 报错IDEA Terminated with exit code 1
- 【异常】远程连接Github、Gitee、Gitlab提示报错Permission denied (publickey)
- vue3 - .eslintignore 配置忽略指定文件或者文件夹的eslint检查报错
- 【错误记录】Groovy 注入方法报错 ( Cannot add new method [hello] for arguments [[]]. It already exists )
- 【错误记录】p7zip 交叉编译 Android 版本 NDK 报错 ( error: case value evaluates to -2 , which cannot be narrowed )
- K8S 报错Failed to inspect image “calico/pod2daemon-flexvol:v3.8.2“
- ubuntu18下Qt4.8.7开发,报错:Gtk-Message: 18:33:13.413: Failed to load module “canberra-gtk-module“
- 嵌入式linux开发,openssl-1.1.1m移植,报错:./libcrypto.so: undefined reference to `makecontext‘
- 华为虚拟专网客户端SecoClient报错“接受返回码超时”故障
- svn编译报错SRTO_STRICTENC
- pip install matplot lib安装报错ERROR: Could not install packages due to an EnvironmentError: [WinError 5
- 使用@Qualifier注解时候,报错:The annotation @Qualifier is disallowed for this location
- AS编译的报错提示:Failed to query the value of property ‘namespace‘
- 完美解决ubuntu2020.04的gcc编译环境下出现报错:undefined reference to `sin‘的问题
- Windows 11 企业版,安装或执行程序时有时会报错:文件系统错误(-1073740771)