Do I need the Sequence Length parameter for RNNCell in Tensorflow

132 views Asked by At

If my input is variable length and I pad it, for example:

[X, Y, Z, PAD, PAD]

And I pass to Tensorflow's RNN cell that:

sequence_length=3

Computation is stopped before the PAD symbol is evaluated, and you get a sequence of output states (one for each input):

outputs = [state1, state2, state3, state4, state5] 

state4 and state5 are all zeros:

state1 = [0.123, -0.351 ...]
...
state4 = [0, 0, 0, ...] 
state5 = [0, 0, 0, ...]

Is it correct that the gradient calculations of my model will not change if I do not pass the sequence_length parameter and instead manually replace state4 and state5 with zero vectors?

0

There are 0 answers