Closed TianrenWang closed 4 years ago
Do you have a minimal example of using an LSTM with the GNN that reproduces this error? When does the error occur? It looks like in the backward pass? Either way it looks like the error is coming from the LSTM variables and not necessarily the graph network variables Which could explain why it works with dense.
On Tue, Mar 17, 2020 at 10:25 PM Frank Wang notifications@github.com wrote:
graph_network = modules.InteractionNetwork( edge_model_fn=lambda: snt.nets.MLP(output_sizes=[1]), node_model_fn=lambda: snt.nets.MLP(output_sizes=[depth]))
global_block = blocks.GlobalBlock(global_model_fn=lambda: snt.nets.MLP(output_sizes=[depth]))
.. . .. . for unused_pass in range(num_recurrent_passes): previous_graphs = graph_network(previous_graphs) previous_graphs = global_block(previous_graphs)
I am getting the following error from the code above: tensorflow.python.framework.errors_impl.AlreadyExistsError: Resource __per_step_8/gradients/lstm/while_grad/lstm/while_grad/body/_794/gradients/AddN_5/tmp_var/N10tensorflow19TemporaryVariableOp6TmpVarE [[{{node gradients/lstm/while_grad/lstm/while_grad/body/_794/gradients/AddN_5/tmp_var}}]]
Before this code block I have an LSTM generate a sequence whose elements are used as write signals to be written into the previous_graphs. I encapsulated the entire above code block with tf.compat.v1.variable_scope(tf.compat.v1.get_variable_scope(), reuse=True) but that didn't work. Replacing the LSTM with just a simple Dense layer removed the problem, so there is some kind of incompatibility between TF LSTM and the GNN. Would appreciate it if you can show me a solution.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/deepmind/graph_nets/issues/111, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQA57GJYMI26YIKE6ZFU3LRIAWK5ANCNFSM4LOCTUBQ .
Indeed, a minimal LSTM + GNN code would not be able to reproduce this error. I fixed the problem by removing the argument for recurrent_dropout in tf.keras.layers.LSTM declaration. I have no idea why this causes the error but at least it is fixed and I don't need the recurrent dropout that desperately.
I am getting the following error from the code above:
tensorflow.python.framework.errors_impl.AlreadyExistsError: Resource __per_step_8/gradients/lstm/while_grad/lstm/while_grad/body/_794/gradients/AddN_5/tmp_var/N10tensorflow19TemporaryVariableOp6TmpVarE [[{{node gradients/lstm/while_grad/lstm/while_grad/body/_794/gradients/AddN_5/tmp_var}}]]
Before this code block I have an LSTM generate a sequence whose elements are used as write signals to be written into the
previous_graphs
. I encapsulated the entire above code block withtf.compat.v1.variable_scope(tf.compat.v1.get_variable_scope(), reuse=True)
but that didn't work. Replacing the LSTM with just a simple Dense layer removed the problem, so there is some kind of incompatibility between TF LSTM and the GNN. Would appreciate it if you can show me a solution.