0
$\begingroup$

With stateful LSTM, are these two methods effectively the same:

for _ in range(3):
    batch_input_shape = [1,10,2]
    x_batch, y_batch = batcher()
    model.train_on_batch(x_batch, y_batch)
model.reset_states()

and

batch_input_shape = [3,10,2]
x_batch, y_batch = batcher()
model.train_on_batch(x_batch, y_batch)
model.reset_states()

i.e. the first method 30 rows of data spread across 3 separate batches of 10 sequences and reset_states() called after all 3 train_on_batch() calls. The second method 30 rows of data submitted in a batch of 3 with 10 sequences, and reset_states() called immediately after.

Assuming it all the same data, and putting aside training times (first method will take longer) is the end result the same?

$\endgroup$
1
$\begingroup$

Answering my own question: they are the same.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.