2

I'd like to generate a batch of sequence with a fixed shape [batch_size, seq_lenth]. Thus my code:

output, _ = tf.nn.ctc_beam_search_decoder(
        logits,
        tf.ones([batch_size])*seq_length,
        merge_repeated=False
        )
output = tf.sparse_to_dense(output[0], default_value=end_id)

where logits is output of dynamic_rnn with shape [max_time, batch_size, cell_output_size]. And I set seq_length to 40. But the resulting output is not of shape [batch_size, seq_length]. And given that its shape is dynamic, I can not pad it to a fixed length. So what should I do to get the output with fixed size? Thanks in advance!

user5779223
  • 1,460
  • 3
  • 21
  • 42

0 Answers0