def _handle_array(array: np.ndarray): array = utils.structed2dict(array) if isinstance(array, dict): output = dict((key, np.array(value).astype(np.float32)) for key, value in array.items()) else: output = np.array(array).astype(np.float32) return output
def structed2dict_trajectory(trajectory): observations, actions, rewards, dones = trajectory observations = utils.structed2dict(observations) actions = utils.structed2dict(actions) trajectory = observations, actions, rewards, dones return trajectory