Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def fast_adapt_a2c(clone, train_episodes, adapt_lr, baseline, gamma, tau, first_order=False):
second_order = not first_order
loss = maml_a2c_loss(train_episodes, clone, baseline, gamma, tau)
gradients = autograd.grad(loss,
clone.parameters(),
retain_graph=second_order,
create_graph=second_order)
return l2l.algorithms.maml.maml_update(clone, adapt_lr, gradients)