-
Notifications
You must be signed in to change notification settings - Fork 418
Closed
Description
Some transforms assume to already have a parent when calling set_parent(), in which case creating a new Compose with them fails:
>>> Compose(t)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/alanschelten/rl/torchrl/envs/transforms/transforms.py", line 630, in __init__
t.set_parent(self)
File "/Users/alanschelten/rl/torchrl/envs/transforms/transforms.py", line 1115, in set_parent
batch_size = parent.batch_size
AttributeError: 'NoneType' object has no attribute 'batch_size'
>>> t = UnsqueezeTransform(0)
>>> Compose(t)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/alanschelten/rl/torchrl/envs/transforms/transforms.py", line 630, in __init__
t.set_parent(self)
File "/Users/alanschelten/rl/torchrl/envs/transforms/transforms.py", line 1115, in set_parent
batch_size = parent.batch_size
AttributeError: 'NoneType' object has no attribute 'batch_size'
>>> t = FlattenObservation()
>>> Compose(t)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/alanschelten/rl/torchrl/envs/transforms/transforms.py", line 630, in __init__
t.set_parent(self)
File "/Users/alanschelten/rl/torchrl/envs/transforms/transforms.py", line 1045, in set_parent
observation_spec = self.parent.observation_spec
File "/Users/alanschelten/rl/torchrl/envs/transforms/transforms.py", line 241, in parent
raise ValueError(
ValueError: Compose parent was of type <class 'NoneType'> but expected TransformedEnv.
Metadata
Metadata
Assignees
Labels
No labels