最近搭建LSTM网络,各个参数都初始化好了,但是进行参数更新时就出错
下面是出错提示
FailedPreconditionError: Error while reading resource variable rnn/multi_rnn_cell/cell_2/layer_2/bias from Container: localhost. This could mean that the variable was uninitialized. Not found: Resource localhost/rnn/multi_rnn_cell/cell_2/layer_2/bias/class tensorflow::Var does not exist.
[[node rnn/multi_rnn_cell/cell_2/layer_2/bias/Read/ReadVariableOp (defined at G:/project/LSTM/LSTM.py:65) ]]
下面是具体的代码
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
from PIL import Image
from loadData import loadData
from tensorflow.contrib import rnn
import os
tf.Graph().as_default()
img_path = r"G:/project/dataset/state-farm-distracted-driver-detection/train"
# 设置用到的参数
lr = 1e-3
# 在训练和测试的时候 想使用不同的batch_size 所以采用占位符的方式
'''
batch_size = tf.placeholder(tf.int32, [])
'''
keep_
版权声明:本文为qq_41102254原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。