reptile_step#
- ivy.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)[source]#
Perform step of Reptile.
- Parameters:
batch (
Container
) – The input batchcost_fn (
Callable
) – callable for the cost function, receivng the task-specific sub-batch and variablesvariables (
Container
) – Variables to be optimizedinner_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
) – The function used for the inner loop optimization. (default:<function gradient_descent_update at 0x7f517c8ec160>
) Default is ivy.gradient_descent_update.batched (
bool
) – Whether to batch along the time dimension, and run the meta steps in batch. (default:True
) Default isTrue
.return_inner_v (
Union
[str
,bool
]) – Either ‘first’, ‘all’, or False. ‘first’ means the variables for the first task (default:False
) inner loop will also be returned. variables for all tasks will be returned with ‘all’. Default isFalse
.num_tasks (
Optional
[int
]) – Number of unique tasks to inner-loop optimize for the meta step. Determined from (default:None
) batch by default.stop_gradients (
bool
) – Whether to stop the gradients of the cost. Default isTrue
. (default:True
)
- Return type:
- Returns:
ret – The cost and the gradients with respect to the outer loop variables.