I came across this answer which is specific to Keras. But my question is at concept level. I am getting confused, How can RNN handle variable size inputs? here
Let us suppose we want to do a sentiment classification
Training batches of different length : Which I think means all training examples in a batch must be of same length but different batches can have variable length training examples.
Now, suppose length of training examples in
- batch-1 = 10,
- batch-2 = 15.
Now while training batch-1 , the RNN unrolls and there would be 10 columns in the below figure to handle input of sequence 10. The shared weights W, U,V dimensions must be in sync with sequence length. I mean the shared weights would be w1,w2,..w10 . I understand till this part.
Now, in While processing batch-2 which is of sequence length 15, The unrolled RNN must take sequence of length 15. That means there are 15 columns in the below figure .
The number of weights changed from 10(w1,w2,...w10) to 15(w1,w2,..w15). Things don't add up here for me.
What happens to shared weights? How are they learnt?