Skip to content

Commit

Permalink
[BugFix] NonTensor should not convert anything to numpy
Browse files Browse the repository at this point in the history
ghstack-source-id: 6006ff9b7edde96f785a599e30945c1c2d53fa97
Pull Request resolved: #2771
  • Loading branch information
vmoens committed Feb 7, 2025
1 parent de2a96e commit 20b7d3d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions torchrl/data/tensor_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2619,6 +2619,18 @@ def unbind(self, dim: int = 0):
for i in range(self.shape[dim])
)

def to_numpy(
self, val: torch.Tensor | TensorDictBase, safe: bool = None
) -> np.ndarray | dict:
return val

def encode(
self,
val: np.ndarray | torch.Tensor | TensorDictBase,
*,
ignore_device: bool = False,
) -> torch.Tensor | TensorDictBase:
return val

class _UnboundedMeta(abc.ABCMeta):
def __call__(cls, *args, **kwargs):
Expand Down

0 comments on commit 20b7d3d

Please sign in to comment.