reptile_step(batch, cost_fn, variables, inner_grad_steps, inner_learning_rate, inner_optimization_step=<function gradient_descent_update>, batched=True, return_inner_v=False, num_tasks=None, stop_gradients=True)¶
Perform step of Reptile.
batch (ivy.Container) – The input batch
cost_fn (callable) – callable for the cost function, receivng the task-specific sub-batch and variables
variables (ivy.Container) – Variables to be optimized
inner_grad_steps (int) – Number of gradient steps to perform during the inner loop.
inner_learning_rate (float) – The learning rate of the inner loop.
inner_optimization_step (callable, optional) – The function used for the inner loop optimization. Default is ivy.gradient_descent_update.
batched (bool, optional) – Whether to batch along the time dimension, and run the meta steps in batch. Default is True.
return_inner_v (str, optional) – Either ‘first’, ‘all’, or False. ‘first’ means the variables for the first task inner loop will also be returned. variables for all tasks will be returned with ‘all’. Default is False.
num_tasks (int, optional) – Number of unique tasks to inner-loop optimize for the meta step. Determined from batch by default.
stop_gradients (bool, optional) – Whether to stop the gradients of the cost. Default is True.
The cost and the gradients with respect to the outer loop variables.