Fixed a fatal flaw with CompositionalObservable

This commit is contained in:
Dominik Moritz Roth 2022-08-22 15:55:16 +02:00
parent 8706462358
commit a41f93beed

View File

@ -342,18 +342,12 @@ class CompositionalObservable(Observable):
for i, obs in enumerate(self.observables): for i, obs in enumerate(self.observables):
space = obs.get_observation_space() space = obs.get_observation_space()
num += math.prod(space.shape) num += math.prod(space.shape)
try: # TODO: lol
low = min(low, float(space.low[0].item()))
high = max(high, float(space.high[0].item()))
except:
pass
if False:
if not i: if not i:
low = space.low low = space.low.reshape((-1))
high = space.high high = space.high.reshape((-1))
else: else:
low = np.vstack((low, space.low)) low = np.hstack((low, space.low.reshape((-1))))
high = np.vstack((high, space.high)) high = np.hstack((high, space.high.reshape((-1))))
return spaces.Box(low=low, high=high, return spaces.Box(low=low, high=high,
shape=(num,), dtype=np.float32) shape=(num,), dtype=np.float32)