tff.learning.optimizers.schedule_learning_rate
Stay organized with collections
Save and categorize content based on your preferences.
Returns an optimizer with scheduled learning rate.
tff.learning.optimizers.schedule_learning_rate(
optimizer: tff.learning.optimizers.Optimizer
,
schedule_fn: Callable[[optimizer_base.Int], optimizer_base.Float]
) -> tff.learning.optimizers.Optimizer
The returned optimizer will use a learning rate of schedule_fn(i)
for the
i
-th invocation of its next
method, indexing from 0.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-20 UTC.
[null,null,["Last updated 2024-09-20 UTC."],[],[],null,["# tff.learning.optimizers.schedule_learning_rate\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |\n\nReturns an optimizer with scheduled learning rate. \n\n tff.learning.optimizers.schedule_learning_rate(\n optimizer: ../../../tff/learning/optimizers/Optimizer,\n schedule_fn: Callable[[optimizer_base.Int], optimizer_base.Float]\n ) -\u003e ../../../tff/learning/optimizers/Optimizer\n\nThe returned optimizer will use a learning rate of `schedule_fn(i)` for the\n`i`-th invocation of its `next` method, indexing from 0.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `optimizer` | A [`tff.learning.optimizers.Optimizer`](../../../tff/learning/optimizers/Optimizer) which uses a learning rate. |\n| `schedule_fn` | A callable mapping integer round number to a floating point learning rate. To be invoked in the context of a [`tff.tensorflow.computation`](../../../tff/tensorflow/computation), thus should support a [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) input. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A [`tff.learning.optimizers.Optimizer`](../../../tff/learning/optimizers/Optimizer). ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `KeyError` | If the provided `optimizer`'s state is not a dictionary with learning rate stored under the [`tff.learning.optimizers.LEARNING_RATE_KEY`](../../../tff/learning/optimizers#LEARNING_RATE_KEY) key. |\n\n\u003cbr /\u003e"]]