def get_filtered_observation_space(self, input_observation_space: ObservationSpace) -> ObservationSpace: if self.stacking_axis == -1: input_observation_space.shape = np.append(input_observation_space.shape, values=[self.stack_size], axis=0) else: input_observation_space.shape = np.insert(input_observation_space.shape, obj=self.stacking_axis, values=[self.stack_size], axis=0) return input_observation_space
def get_filtered_observation_space( self, input_observation_space: ObservationSpace) -> ObservationSpace: axis_size = input_observation_space.shape[self.axis_origin] input_observation_space.shape = np.delete( input_observation_space.shape, self.axis_origin) if self.axis_target == -1: input_observation_space.shape = np.append( input_observation_space.shape, axis_size) elif self.axis_target < -1: input_observation_space.shape = np.insert( input_observation_space.shape, self.axis_target + 1, axis_size) else: input_observation_space.shape = np.insert( input_observation_space.shape, self.axis_target, axis_size) # move the channels axis according to the axis change if isinstance(input_observation_space, PlanarMapsObservationSpace): if input_observation_space.channels_axis == self.axis_origin: input_observation_space.channels_axis = self.axis_target elif input_observation_space.channels_axis == self.axis_target: input_observation_space.channels_axis = self.axis_origin elif self.axis_origin < input_observation_space.channels_axis < self.axis_target: input_observation_space.channels_axis -= 1 elif self.axis_target < input_observation_space.channels_axis < self.axis_origin: input_observation_space.channels_axis += 1 return input_observation_space
def get_filtered_observation_space( self, input_observation_space: ObservationSpace) -> ObservationSpace: dummy_tensor = np.random.rand(*tuple(input_observation_space.shape)) input_observation_space.shape = dummy_tensor.squeeze( axis=self.axis).shape return input_observation_space
def get_filtered_observation_space( self, input_observation_space: ObservationSpace) -> ObservationSpace: # replace -1 with the max size crop_high = self._replace_negative_one_in_crop_size( self.crop_high, input_observation_space.shape) crop_low = self._replace_negative_one_in_crop_size( self.crop_low, input_observation_space.shape) input_observation_space.shape = crop_high - crop_low return input_observation_space
def get_filtered_observation_space( self, input_observation_space: ObservationSpace) -> ObservationSpace: input_observation_space.shape = input_observation_space.shape[:-1] return input_observation_space
def get_filtered_observation_space( self, input_observation_space: ObservationSpace) -> ObservationSpace: input_observation_space.shape = self.output_observation_space.shape return input_observation_space