def sample(self, batch_info: BatchInfo, model: RlModel, number_of_steps: int) -> Rollout:
if self.forward_steps > <NUM_LIT:1>:<EOL><INDENT>transitions = self.replay_buffer.sample_forward_transitions(<EOL>batch_size=number_of_steps, batch_info=batch_info, forward_steps=self.forward_steps,<EOL>discount_factor=self.discount_factor<EOL>)<EOL><DEDENT>else:<EOL><INDENT>transitions = self.replay_buffer.sample_transitions(batch_size=number_of_steps, batch_info=batch_info)<EOL><DEDENT>if self.ret_rms is not None:<EOL><INDENT>rewards = transitions.transition_tensors['<STR_LIT>']<EOL>new_rewards = torch.clamp(rewards / np.sqrt(self.ret_rms.var + <NUM_LIT>), -self.clip_obs, self.clip_obs)<EOL>transitions.transition_tensors['<STR_LIT>'] = new_rewards<EOL><DEDENT>return transitions<EOL>
Sample experience from replay buffer and return a batch