tensorflow运行错误及解决方法--一直更新
tensorflow
一个面向所有人的开源机器学习框架
项目地址:https://gitcode.com/gh_mirrors/te/tensorflow

·
1.
FailedPreconditionError: Attempting to use uninitialized value beta1_power
[[Node: beta1_power/read = Identity[T=DT_FLOAT, _class=["loc:@Variable"], _device="/job:localhost/replica:0/task:0/gpu:0"](beta1_power)]]
[[Node: Mean_1/_11 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_103_Mean_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]
FailedPreconditionError (see above for traceback): Attempting to use uninitialized value beta1_power
[[Node: beta1_power/read = Identity[T=DT_FLOAT, _class=["loc:@Variable"], _device="/job:localhost/replica:0/task:0/gpu:0"](beta1_power)]]
[[Node: Mean_1/_11 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_103_Mean_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]
原因,tensorflow所有的变量都需要初始化,运行之前,加上
init = tf.global_variables_initializer()
sess.run(init)
即可解决
2.ValueError: Parent directory of my_model.ckpt doesn’t exist, can’t save.
tensorflow
一个面向所有人的开源机器学习框架
项目地址:https://gitcode.com/gh_mirrors/te/tensorflow
解决方法:保存模型时在模型前面加上绝对路径
3.运行网上download的代码时,第一遍能够正常跑并保存模型。第二次运行时就卡在sess.run()数据那一步了。但是没有warning,也没有error。
暂时没有找到原因,但是有以下几个解决方法可以尝试一下:
- 更换code所在路径,也就是把code在另外的文件夹里在复制一下。记得删除log和checkpoint文件夹
- 重新在另外的文件夹生成数据集
- unbun下运行时,若你的代码是放在windows盘下,且windows盘没有进行人工命名时,每次重启系统是会更换名字的。例如,新加卷1,重新打开电脑可能就变成了新加卷2,这样可能是会影响代码运行。
查看一下csdnn与cuda的版本(如果你有GPU),有时候版本太高也有出一些莫名其妙的问。我这次就把电脑里的cudnn由7.1降级到了5.1。
overall,我也不知道到底是那一条拯救的我的程序,出现问题是,建议可以都试一试。
推荐内容




一个面向所有人的开源机器学习框架
最近提交(Master分支:2 个月前 )
4f64a3d5
Instead, check for this case in `ResolveUsers` and `ResolveOperand`, by querying whether the `fused_expression_root` is part of the `HloFusionAdaptor`.
This prevents us from stepping into nested fusions.
PiperOrigin-RevId: 724311958
2 个月前
aa7e952e
Fix a bug in handling negative strides, and add a test case that exposes it.
We can have negative strides that are not just -1, e.g. with a combining
reshape.
PiperOrigin-RevId: 724293790
2 个月前
更多推荐
所有评论(0)