code: def _make_dataset(
      episodes,
      model,
      phi,
      batch_states,
      obs_normalizer,
      gamma,
      lambd,
      device,
  ):
      """Make a list of transitions with necessary information."""
  
      _add_log_prob_and_value_to_episodes(
          episodes=episodes,
          model=model,
          phi=phi,
          batch_states=batch_states,
          obs_normalizer=obs_normalizer,
          device=device,
      )
  
      _add_advantage_and_value_target_to_episodes(
          episodes, gamma=gamma, lambd=lambd
      )
  
      return list(itertools.chain.from_iterable(episodes))
  
imports: import collections
  import itertools
  import random
  import numpy
  import torch
  import torch.nn.functional
  import pfrl
  from pfrl import agent
  from pfrl.utils.batch_states import batch_states
  from pfrl.utils.mode_of_distribution import mode_of_distribution
  from pfrl.utils.recurrent import concatenate_recurrent_states, flatten_sequences_time_first, get_recurrent_state_at, mask_recurrent_state_at, one_step_forward, pack_and_forward
label_desc: Use image node_id 11 for calling a global function with example usage: _make_dataset(episodes, model, phi, batch_states, obs_normalizer, gamma, lambd, device) and returns: list