ValueError: Variable rnn/lstm_cell/kernel does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=None in VarScope?
I use tensorflow1.3+python3.5 in windows,so i change the code like this: def LSTM_single(self, name, _X, _istate, _weights, _biases): with tf.device('/gpu:0'): # input shape: (batch_size, n_steps, n_input) 1-3-5002 _X = tf.transpose(_X, [1, 0, 2]) # permute num_steps and batch_size # Reshape to prepare input to hidden activation _X = tf.reshape(_X, [self.num_steps * self.batch_size, self.num_input]) # (num_steps*batch_size, num_input) # Split data because rnn cell needs a list of inputs for the RNN inner loop #_X = tf.split(0, self.num_steps, _X) # n_steps * (batch_size, num_input) #x = tf.split(x, n_steps, 0) 1.2之后的版本改了 _X = tf.split(_X, self.num_steps, 0)
cell = tf.contrib.rnn.LSTMCell(self.num_input,state_is_tuple=False) #tf.nn.rnn_cell
state = _istate
for step in range(self.num_steps):
outputs, state = tf.contrib.rnn.static_rnn(cell, [_X[step]],state, dtype=tf.float32) #tf.nn.rnn tf.nn.rnn_cell.BasicLSTMCell
tf.get_variable_scope().reuse_variables()
return outputs
when I run ROLO_network_test_all.py there is a error like this: ValueError: Variable rnn/lstm_cell/kernel does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=None in VarScope? how to sovle it? maybe we can discuss it . my email:[email protected]
did you solve your problem?The problem i met is the same as yours.
you should write your code in this way
tf.variable_scope(name):
cell = tf.contrib.rnn.LSTMCell(self.num_input,state_is_tuple=False) #tf.nn.rnn_cell
state = _istate
for step in range(self.num_steps):
outputs, state = tf.contrib.rnn.static_rnn(cell, [_X[step]],state, dtype=tf.float32) #tf.nn.rnn
tf.nn.rnn_cell.BasicLSTMCell
tf.get_variable_scope().reuse_variables()
return outputs
you should write your code in this way
tf.variable_scope(name): cell = tf.contrib.rnn.LSTMCell(self.num_input,state_is_tuple=False) #tf.nn.rnn_cell state = _istate for step in range(self.num_steps):
outputs, state = tf.contrib.rnn.static_rnn(cell, [_X[step]],state, dtype=tf.float32) #tf.nn.rnn
tf.nn.rnn_cell.BasicLSTMCell
tf.get_variable_scope().reuse_variables()__
return outputs
you should write your code in this way
tf.variable_scope(name): cell = tf.contrib.rnn.LSTMCell(self.num_input,state_is_tuple=False) #tf.nn.rnn_cell state = _istate for step in range(self.num_steps):
outputs, state = tf.contrib.rnn.static_rnn(cell, [_X[step]],state, dtype=tf.float32) #tf.nn.rnn
tf.nn.rnn_cell.BasicLSTMCell
tf.get_variable_scope().reuse_variables()__
return outputs
你好,请问一下你又成功运行起来ROLO吗,能不能留个联系方式啊,我跑的时候遇到一些问题想要咨询一下您