It seems tensorflow does not support variable batch size for bidirectional RNN. In this example the sequence_length
is tied to batch_size
, which is a Python integer:
_seq_len = tf.fill([batch_size], tf.constant(n_steps, dtype=tf.int64))
outputs, state1,state2 = rnn.bidirectional_rnn(rnn_fw_cell, rnn_bw_cell, input,
dtype="float",
sequence_length=_seq_len)
How can I use different batch sizes for training and testing?