At first I thought I had misunderstood something about the Tensorflow API. Now I suspect that I have simply misunderstood how variable scope is managed in Jupyter notebooks.
Tensorflow's LSTM tutorial example recurrent_network.py works beautifully if I plug all of the code into a single cell in a jupyter notebook and run it. But when I carve up the program into separate cells, even when running everything in proper order (definitions first, etc.), I get a variable scope error:
15 # Get lstm cell output
---> 16 outputs, states = rnn.static_rnn(lstm_cell, x, dtype=tf.float32)
ValueError: Variable rnn/basic_lstm_cell/kernel already exists, disallowed. Did you mean to set reuse=True in VarScope? Originally defined at: site-packages\tensorflow\python\framework\ops.py", line 1269, in init
Other StackOverflow articles address the occurrence of this error in cases where people are reusing basic LSTM cells, but I am not reusing LSTM cells, and again, the code in recurrent_network.py works fine in my jupyter notebook provided I keep it all in one cell.
What might be going on?