有什么想法可以解决下面显示的问题吗?根据我在网上找到的信息,它与重用张量流范围的问题相关,但没有任何效果。
ValueError: Variable rnn/basic_rnn_cell/kernel already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? Originally defined at:
File "/code/backend/management/commands/RNN.py", line 370, in predict
states_series, current_state = tf.nn.dynamic_rnn(cell=cell, inputs=batchX_placeholder, dtype=tf.float32)
File "/code/backend/management/commands/RNN.py", line 499, in Command
predict("string")
File "/code/backend/management/commands/RNN.py", line 12, in <module>
class Command(BaseCommand):
例如我尝试过这样的事情
with tf.variable_scope('scope'):
states_series, current_state = tf.nn.dynamic_rnn(cell=cell, inputs=batchX_placeholder, dtype=tf.float32)
and this
with tf.variable_scope('scope', reuse = True ):
states_series, current_state = tf.nn.dynamic_rnn(cell=cell, inputs=batchX_placeholder, dtype=tf.float32)
and this
with tf.variable_scope('scope', reuse = tf.AUTO_REUSE ):
states_series, current_state = tf.nn.dynamic_rnn(cell=cell, inputs=batchX_placeholder, dtype=tf.float32)
有任何想法吗?