class_docstr: Model-Agnostic Meta-Learning (MAML).
  
  Args:
      inner_algo (garage.torch.algos.VPG): The inner algorithm used for
          computing loss.
      env (Environment): An environment.
      policy (garage.torch.policies.Policy): Policy.
      sampler (garage.sampler.Sampler): Sampler.
      task_sampler (garage.experiment.TaskSampler): Task sampler.
      meta_optimizer (Union[torch.optim.Optimizer, tuple]):
          Type of optimizer.
          This can be an optimizer type such as `torch.optim.Adam` or a tuple
          of type and dictionary, where dictionary contains arguments to
          initialize the optimizer e.g. `(torch.optim.Adam, {'lr' : 1e-3})`.
      meta_batch_size (int): Number of tasks sampled per batch.
      inner_lr (float): Adaptation learning rate.
      outer_lr (float): Meta policy learning rate.
      num_grad_updates (int): Number of adaptation gradient steps.
      meta_evaluator (MetaEvaluator): A meta evaluator for meta-testing. If
          None, don't do meta-testing.
      evaluate_every_n_epochs (int): Do meta-testing every this epochs.
docstr: Adapt the policy by one gradient steps for a task.
  
  Args:
      exploration_policy (Policy): A policy which was returned from
          get_exploration_policy(), and which generated
          exploration_episodes by interacting with an environment.
          The caller may not use this object after passing it into this
          method.
      exploration_episodes (EpisodeBatch): Episodes with which to adapt,
          generated by exploration_policy exploring the environment.
  
  Returns:
      Policy: A policy adapted to the task represented by the
          exploration_episodes.
docstr_tok: ["Adapt","the","policy","by","one","gradient","steps","for","a","task",".","Args",":","exploration_policy","(","Policy",")",":","A","policy","which","was","returned","from","get_exploration_policy","(",")",",","and","which","generated","exploration_episodes","by","interacting","with","an","environment",".","The","caller","may","not","use","this","object","after","passing","it","into","this","method",".","exploration_episodes","(","EpisodeBatch",")",":","Episodes","with","which","to","adapt",",","generated","by","exploration_policy","exploring","the","environment",".","Returns",":","Policy",":","A","policy","adapted","to","the","task","represented","by","the","exploration_episodes","."]
code: def adapt_policy(self, exploration_policy, exploration_episodes):
      """Adapt the policy by one gradient steps for a task.
  
      Args:
          exploration_policy (Policy): A policy which was returned from
              get_exploration_policy(), and which generated
              exploration_episodes by interacting with an environment.
              The caller may not use this object after passing it into this
              method.
          exploration_episodes (EpisodeBatch): Episodes with which to adapt,
              generated by exploration_policy exploring the environment.
  
      Returns:
          Policy: A policy adapted to the task represented by the
              exploration_episodes.
  
      """
      old_policy, self._policy = self._policy, exploration_policy
      self._inner_algo.policy = exploration_policy
      self._inner_optimizer.module = exploration_policy
  
      batch_samples = self._process_samples(exploration_episodes)
  
      self._adapt(batch_samples, set_grad=False)
  
      self._policy = old_policy
      self._inner_algo.policy = (
          self._inner_optimizer.module
      ) = old_policy
      return exploration_policy
  
imports: import collections
  import copy
  from dowel import tabular
  import numpy
  import torch
  from garage import _Default, EpisodeBatch, log_multitask_performance, make_optimizer
  from garage.np import discount_cumsum
  from garage.torch import update_module_params
  from garage.torch._functions import np_to_torch, zero_optim_grads
  from garage.torch.optimizers import ConjugateGradientOptimizer, DifferentiableSGD
label_desc: Use image node_id 16 for calling the MAML obj's underlying member method code with example usage: obj.adapt_policy(exploration_policy, exploration_episodes) and returns: exploration_policy