I will preface this answer that this is NOT a complete solution, but rather a comment on how to improve your cell.
To get started, in your ACTStep function, you call rnn.rnn for one temporary value (as defined by [input] ). If you are executing a single timecode, it is probably more efficient to just use the actual self.cell you will see the same mechanism used in the rnncell wrappers tensor stream
You mentioned that you tried to use TensorArrays . Did you pack and unpack tensor diagrams properly? Here is the repo where you will find in the model.py section the tensor diagrams are packed and unpacked properly.
You also asked if there is a function in control_flow_ops that would require the accumulation of all tensors. I think you are looking for tf.control_dependencies
You can list all your output tensors in control_dependicies, and to calculate all the tensors at this point, you need a tensor flow.
Also, it looks like your counter variable is trainable. Are you sure you want this to be so? If you add a plus one to your counter, this probably will not give the correct result. On the other hand, you could keep it up to date in order to differentiate it at the end for a function of the cost of thinking.
I also think that the Remainder function should be in your script:
remainder = 1.0 - tf.add_n(acc_probs[:-1])
Here is my version of your code:
class ACTCell(RNNCell): """An RNN cell implementing Graves' Adaptive Computation time algorithm Notes: https://www.evernote.com/shard/s189/sh/fd165646-b630-48b7-844c-86ad2f07fcda/c9ab960af967ef847097f21d94b0bff7 """ def __init__(self, num_units, cell, max_computation = 5.0, epsilon = 0.01): self.one_minus_eps = tf.constant(1.0 - epsilon)
This is a complex document to implement that I worked on myself. I would not mind working with you to do this in Tensorflow. If you are interested, please add me to LeavesBreathe via Skype and we can leave from there.