Skip to content

Commit c5afe3c

Browse files
author
Vincent Moens
committed
[BugFix] Remove neg dim checks in expand for all specs
ghstack-source-id: f718328 Pull Request resolved: #2906
1 parent e5cba04 commit c5afe3c

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

torchrl/data/tensor_specs.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,13 +2228,6 @@ def high(self):
22282228
def expand(self, *shape):
22292229
if len(shape) == 1 and isinstance(shape[0], (tuple, list, torch.Size)):
22302230
shape = shape[0]
2231-
if any(
2232-
orig_val != val and val < 0
2233-
for val, orig_val in zip(shape[-len(self.shape) :], self.shape)
2234-
):
2235-
raise ValueError(
2236-
f"{self.__class__.__name__}.expand does not support negative shapes."
2237-
)
22382231
if any(s1 != s2 and s2 != 1 for s1, s2 in zip(shape[-self.ndim :], self.shape)):
22392232
raise ValueError(
22402233
f"The last {self.ndim} of the expanded shape {shape} must match the"

0 commit comments

Comments
 (0)