Open heyayun18188 opened 5 years ago
I also meet this problem, do you solve it now?
Hi, this small change do the trick...
def generate_train_batch(self, seq_len, batch_size, normalise):
i = 0
while True:
x_batch = []
y_batch = []
for b in range(batch_size):
x, y = self._next_window(i, seq_len, normalise)
x_batch.append(x)
y_batch.append(y)
i += 1
if i == (self.len_train - seq_len):
# stop-condition for a smaller final batch if data doesn't divide evenly
i = 0
yield np.array(x_batch), np.array(y_batch)
x_batch = []
y_batch = []
yield np.array(x_batch), np.array(y_batch)
When the process runs into the 17th epoch. StopIteration error comes out.