Skip to content

Commit 6fd9682

Browse files
committed
Clone task_future_target
1 parent 9fd3278 commit 6fd9682

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/chronos/chronos2/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ def _construct_slice(self, task_idx: int) -> tuple[torch.Tensor, torch.Tensor |
502502
# the task_context_tensor by slicing the appropriate indices which we do below
503503
if self.mode in [DatasetMode.TRAIN, DatasetMode.VALIDATION]:
504504
# the first task_n_targets elements in task_context_tensor are the targets
505-
task_future_target = task_past_tensor[:, slice_idx : slice_idx + self.prediction_length]
505+
task_future_target = task_past_tensor[:, slice_idx : slice_idx + self.prediction_length].clone()
506506
# mask out all rows corresponding to covariates
507507
task_future_target[task_n_targets:] = torch.nan
508508

0 commit comments

Comments
 (0)