0

In the lastest tensorflow tf.contrib.layers.embed_sequence() is used for classifying text with fixed-length.

I want to know if RNN can classify text with variable length?

And is there any API in tensorflow about this?

Thanks!

Alexandre Neukirchen
  • 2,713
  • 7
  • 26
  • 36
user7204017
  • 65
  • 1
  • 6

1 Answers1

0

This is not written in the current API documentation. If you need to vary the length pick a large length and pad your sentences.

embed_sequence(ids,
              vocab_size=None,
              embed_dim=None,
              unique=False,
              initializer=None,
              regularizer=None,
              trainable=True,
              scope=None,
              reuse=None)

For comments and notes in the source code go here.

You might find these links useful: Variable Sequence Lengths in TensorFlow, Tensorflow RNN with varying length sentences

Community
  • 1
  • 1
Brian O'Donnell
  • 1,836
  • 19
  • 29
  • Maybe it's not very well expressed.I have used it before and it worked very well.As we know,text is always with different length.For examples,if ids is[[0,1,2,3,4],[5,6,7,8]],can RNN train?I wonder if we need new function about that.Thank you for your help! – user7204017 Nov 29 '16 at 13:53