fix: respect batch_size in v1 data_loader when permute=False

Apply changes from PR #391 by @MarcoGorworworelli:
- Fix train_gen() to iterate in proper batch_size chunks instead of
  yielding all time series at once when permute=False
- Add test_data_loader.py to verify batch boundaries
This commit is contained in:
darkpowerxo
2026-04-08 14:18:02 -04:00
parent a63360a57c
commit 1bb44d5eef
2 changed files with 53 additions and 2 deletions
+3 -2
View File
@@ -149,11 +149,12 @@ class TimeSeriesdata(object):
else:
epoch_len = self.epoch_len
for idx in perm[0:epoch_len]:
for _ in range(num_ts // self.batch_size + 1):
batch_indices = range(0, num_ts, self.batch_size)
for batch_idx in batch_indices:
if self.permute:
tsidx = np.random.choice(num_ts, size=self.batch_size, replace=False)
else:
tsidx = np.arange(num_ts)
tsidx = np.arange(batch_idx, min(batch_idx + self.batch_size, num_ts))
dtimes = np.arange(idx - hist_len, idx + self.pred_len)
(
bts_train,