Skip to content

Commit e803ffa

Browse files
authored
[BugFix] sending data to device for optim steps (#655)
1 parent e8f54eb commit e803ffa

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

torchrl/trainers/helpers/trainers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ def make_trainer(
222222
"process_optim_batch",
223223
BatchSubSampler(batch_size=cfg.batch_size, sub_traj_len=cfg.sub_traj_len),
224224
)
225+
trainer.register_op("process_optim_batch", lambda batch: batch.to(device))
225226

226227
if optim_scheduler is not None:
227228
trainer.register_op("post_optim", optim_scheduler.step)

0 commit comments

Comments
 (0)