微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

FailedPreconditionError:从容器读取资源变量dense_95/kernel时出错:本地主机

如何解决FailedPreconditionError:从容器读取资源变量dense_95/kernel时出错:本地主机

我提前定义了一个 VAEloss 函数。当我调用这个函数并得到一个阈值时,我发现它是一个张量变量。当我尝试使用以下命令查看此 Tensor 时,系统报告错误。有谁知道如何解决它? 错误信息如下:

`def vae_loss(x,x_decoded_mean):
  xent_loss=original_dim*objectives.binary_crossentropy(x,x_decoded_mean)
  kl_loss=-0.5*K.sum(1+z_log_var-K.square(z_mean)-K.exp(z_log_var),axis=-1)
  return xent_loss+kl_loss
vae=Model(x,x_decoded_mean)
vae.compile(optimizer='rmsprop',loss=vae_loss,experimental_run_tf_function = False)
vae.summary()`
`thereshold=vae_loss(data_train,train_x_pred)
thereshold_mean=tf.reduce_mean(thereshold)
t_max=tf.argmax(thereshold,0)
with tf.Session() as sess:
print(sess.run(t_max))`

FailedPreconditionError:从容器读取资源变量密集_95/内核时出错:本地主机。这可能意味着该变量未初始化。未找到:容器 localhost 不存在。 (找不到资源:localhost/dense_95/kernel) [[{{节点密集_95/MatMul/ReadVariableOp}}]]

在处理上述异常的过程中,又发生了一个异常:

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。