简体   繁体   中英

I want to use variable length input with dynamic RNN of tensorflow, but I don't know how to padding

As an example, input tensor is a batch size 3, a maximum time sequence length 4 and dimension of feature value is 2

[ [ [1, 2], [3, 4], [5, 6], [7, 8] ], [ [9, 10] ] ]

, And in order to make it an input to RNN

[ [ [1, 2], [3, 4], [5, 6], [7, 8] ], [ [9, 10], [0,0], [0,0], [0,0] ] ]

I would like to have a form like this, is there a good way to do it? Since we assume that the tensor to be input to this RNN is the feature amount extracted by another neural network before entering RNN, I would like to know a method that will not break the calculation graph.

我认为可能需要tf.train.batchhttps://www.tensorflow.org/api_docs/python/tf/train/batch )并使用dynamic_pad = True

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM