class_docstr: RL^2.
  
  Reference: https://arxiv.org/pdf/1611.02779.pdf.
  
  When sampling for RL^2, there are more than one environments to be
  sampled from. In the original implementation, within each task/environment,
  all episodes sampled will be concatenated into one single episode, and fed
  to the inner algorithm. Thus, returns and advantages are calculated across
  the episode.
  
  RL2Worker is required in sampling for RL2.
  See example/tf/rl2_ppo_halfcheetah.py for reference.
  
  User should not instantiate RL2 directly.
  Currently garage supports PPO and TRPO as inner algorithm. Refer to
  garage/tf/algos/rl2ppo.py and garage/tf/algos/rl2trpo.py.
  
  Args:
      env_spec (EnvSpec): Environment specification.
      episodes_per_trial (int): Used to calculate the max episode length for
          the inner algorithm.
      meta_batch_size (int): Meta batch size.
      task_sampler (TaskSampler): Task sampler.
      meta_evaluator (MetaEvaluator): Evaluator for meta-RL algorithms.
      n_epochs_per_eval (int): If meta_evaluator is passed, meta-evaluation
          will be performed every `n_epochs_per_eval` epochs.
      inner_algo_args (dict): Arguments for inner algorithm.
class_docstr_tok: ["RL^2",".","Reference",":","https",":","\/\/arxiv.org\/pdf\/1611.02779.pdf",".","When","sampling","for","RL^2",",","there","are","more","than","one","environments","to","be","sampled","from",".","In","the","original","implementation",",","within","each","task\/environment",",","all","episodes","sampled","will","be","concatenated","into","one","single","episode",",","and","fed","to","the","inner","algorithm",".","Thus",",","returns","and","advantages","are","calculated","across","the","episode",".","RL2Worker","is","required","in","sampling","for","RL2",".","See","example\/tf\/rl2_ppo_halfcheetah.py","for","reference",".","User","should","not","instantiate","RL2","directly",".","Currently","garage","supports","PPO","and","TRPO","as","inner","algorithm",".","Refer","to","garage\/tf\/algos\/rl2ppo.py","and","garage\/tf\/algos\/rl2trpo.py",".","Args",":","env_spec","(","EnvSpec",")",":","Environment","specification",".","episodes_per_trial","(","int",")",":","Used","to","calculate","the","max","episode","length","for","the","inner","algorithm",".","meta_batch_size","(","int",")",":","Meta","batch","size",".","task_sampler","(","TaskSampler",")",":","Task","sampler",".","meta_evaluator","(","MetaEvaluator",")",":","Evaluator","for","meta-RL","algorithms",".","n_epochs_per_eval","(","int",")",":","If","meta_evaluator","is","passed",",","meta-evaluation","will","be","performed","every","`","n_epochs_per_eval","`","epochs",".","inner_algo_args","(","dict",")",":","Arguments","for","inner","algorithm","."]
docstr: int: Maximum length of an episode.
docstr_tok: ["int",":","Maximum","length","of","an","episode","."]
code: def max_episode_length(self):
      """int: Maximum length of an episode."""
      return self._rl2_max_episode_length
  
imports: import abc
  import collections
  import akro
  from dowel import logger
  import numpy
  from garage import EnvSpec, EnvStep, EpisodeBatch, log_multitask_performance, StepType, Wrapper
  from garage.np.algos import MetaRLAlgorithm
  from garage.sampler import DefaultWorker
  from garage.tf.algos._rl2npo import RL2NPO
label_desc: Use image node_id 9 for calling the RL2 obj's underlying member method code with example usage: obj.max_episode_length() and returns: self