def aggregate(self, exp_list):
        '''
            Aggregates a list of subtrajectory dictionaries into dictionary of 
            batched sub-trajectory
            Args:
                exp_list: list of dictionaries that are sub-trajectory attribute
            Returns:
                dict of tensorized subtrajectory information
        '''
        observations, next_obs, actions, rewards, dones, persistent_infos, onetime_infos = [], [], [], [], [], [], []
        for exp in exp_list:
            action_n_step, reward_n_step, done_n_step = self._stack_n_step_experience(exp)
            actions.append(action_n_step)
            rewards.append(reward_n_step)
            dones.append(done_n_step)
            observations.append(exp['obs'])
            next_obs.append([exp['obs_next']])

        observations = self._batch_obs(observations)
        next_obs = self._batch_obs(next_obs)

        if self.action_type == ActionType.discrete:
            actions = np.expand_dims(2).astype('int64')
        elif self.action_type is not ActionType.continuous:
            raise NotImplementedError('action_spec unsupported '+str(self.action_spec))

        onetime_infos, persistent_infos = self._gather_action_infos(exp_list)
        return {'obs': observations,
                'obs_next': next_obs,
                'actions': np.stack(actions),
                'rewards': np.stack(rewards),
                'persistent_infos': persistent_infos,
                'onetime_infos': onetime_infos,
                'dones': np.stack(dones).astype('float32')}

            Aggregates a list of subtrajectory dictionaries into dictionary of 
            batched sub-trajectory
            Args:
                exp_list: list of dictionaries that are sub-trajectory attribute
            Returns:
                dict of tensorized subtrajectory information
        
surreal/learner/aggregator.py