Skip to content

Commit b8032f1

Browse files
committed
Clone tensors when construcing slices
1 parent 6fd9682 commit b8032f1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/chronos/chronos2/dataset.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ def _construct_slice(self, task_idx: int) -> tuple[torch.Tensor, torch.Tensor |
477477
task_n_covariates,
478478
task_n_future_covariates,
479479
) = self.tasks[task_idx]
480+
task_past_tensor, task_future_tensor = task_past_tensor.clone(), task_future_tensor.clone()
480481
task_n_past_only_covariates = task_n_covariates - task_n_future_covariates
481482

482483
full_length = task_past_tensor.shape[-1]

0 commit comments

Comments
 (0)