Skip to content

Commit

Permalink
[BugFix] Fix DDPG squeezing (#1487)
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Bettini <matbet@meta.com>
  • Loading branch information
matteobettini authored Sep 7, 2023
1 parent 786020d commit d8504e7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions torchrl/objectives/ddpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
from typing import Tuple

import torch

from tensordict.nn import dispatch, make_functional, repopulate_module, TensorDictModule
from tensordict.tensordict import TensorDict, TensorDictBase
from tensordict.utils import NestedKey

from torchrl.modules.tensordict_module.actors import ActorCriticWrapper
from torchrl.objectives.common import LossModule
from torchrl.objectives.utils import (
Expand Down Expand Up @@ -269,7 +269,6 @@ def forward(self, tensordict: TensorDictBase) -> TensorDict:
"""
loss_value, td_error, pred_val, target_value = self._loss_value(tensordict)
td_error = td_error.detach()
td_error = td_error.unsqueeze(tensordict.ndimension())
if tensordict.device is not None:
td_error = td_error.to(tensordict.device)
tensordict.set(
Expand Down

0 comments on commit d8504e7

Please sign in to comment.