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.
class_docstr_tok: ["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",",","do","n't","do","meta-testing",".","evaluate_every_n_epochs","(","int",")",":","Do","meta-testing","every","this","epochs","."]
code: def __init__(
      self,
      inner_algo,
      env,
      policy,
      sampler,
      task_sampler,
      meta_optimizer,
      meta_batch_size=40,
      inner_lr=0.1,
      outer_lr=1e-3,
      num_grad_updates=1,
      meta_evaluator=None,
      evaluate_every_n_epochs=1,
  ):
      self._sampler = sampler
  
      self.max_episode_length = inner_algo.max_episode_length
  
      self._meta_evaluator = meta_evaluator
      self._policy = policy
      self._env = env
      self._task_sampler = task_sampler
      self._value_function = copy.deepcopy(inner_algo._value_function)
      self._initial_vf_state = self._value_function.state_dict()
      self._num_grad_updates = num_grad_updates
      self._meta_batch_size = meta_batch_size
      self._inner_algo = inner_algo
      self._inner_optimizer = DifferentiableSGD(
          self._policy, lr=inner_lr
      )
      self._meta_optimizer = make_optimizer(
          meta_optimizer,
          module=policy,
          lr=_Default(outer_lr),
          eps=_Default(1e-5),
      )
      self._evaluate_every_n_epochs = evaluate_every_n_epochs
  
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 1 to create a new MAML object  with example: obj = MAML(inner_algo, env, policy, sampler, task_sampler, meta_optimizer, meta_batch_size, inner_lr, outer_lr, num_grad_updates, meta_evaluator, evaluate_every_n_epochs)