Skip to content Skip to sidebar Skip to footer

Gradients Error Using TensorArray Tensorflow

i am trying to implement multidimentional lstm in tensorflow, I am using TensorArray to remember previous states, i am using a complicated way to get two neigbours state(above and

Solution 1:

You should add parameter parallel_iterations=1 to your while loop call. Such as:

result, outputs_ta, states_ta = tf.while_loop(
    condition, body, [time,outputs_ta,states_ta], parallel_iterations=1)

This is required because inside body you perform read and write operations on the same tensor array (states_ta). And in case of parallel loop execution(parallel_iterations > 1) some thread may try to read info from tensorArray, that was not written to it by another one.

I've test your code snippet with parallel_iterations=1 on tensorflow 0.12.1 and it works as expected.


Post a Comment for "Gradients Error Using TensorArray Tensorflow"