[AMP] add get() and set() for Grad_scaler#33835
Merged
zhiqiu merged 4 commits intoPaddlePaddle:developfrom Jul 1, 2021
Merged
Conversation
|
Thanks for your contribution! |
TCChenlong
reviewed
Jun 30, 2021
| def is_use_loss_scaling(self): | ||
| """ | ||
| Enable loss scaling or not. | ||
|
|
Contributor
There was a problem hiding this comment.
这里需要加一个 Returns: 然后说明返回类型,以及什么情况下会返回什么样的值
| def is_use_dynamic_loss_scaling(self): | ||
| """ | ||
| Whether to use dynamic loss scaling. | ||
|
|
|
|
||
| Examples: | ||
| .. code-block:: python | ||
| import paddle |
Contributor
There was a problem hiding this comment.
.. code & import 这两行中间需要加一个空行 否则预览会有问题
|
|
||
| Examples: | ||
| .. code-block:: python | ||
| import paddle |
|
|
||
| Examples: | ||
| .. code-block:: python | ||
| import paddle |
| def get_init_loss_scaling(self): | ||
| """ | ||
| Return the initial loss scaling factor. | ||
|
|
zhiqiu
reviewed
Jun 30, 2021
| """ | ||
| return super(GradScaler, self).minimize(optimizer, *args, **kwargs) | ||
|
|
||
| def is_enable(self): |
| """ | ||
| return super(GradScaler, self).is_enable() | ||
|
|
||
| def is_use_dynamic_loss_scaling(self): |
Contributor
There was a problem hiding this comment.
is_use_dynamic_loss_scaling -> is_dynamic_loss_scaling_used?
TCChenlong
reviewed
Jun 30, 2021
| incr_every_n_steps=1000, | ||
| decr_every_n_nan_or_inf=2, | ||
| use_dynamic_loss_scaling=True) | ||
| enable = scaler.get_enable() |
Contributor
There was a problem hiding this comment.
scaler.get_enable -> scaler.is_enable
| incr_every_n_steps=1000, | ||
| decr_every_n_nan_or_inf=2, | ||
| use_dynamic_loss_scaling=True) | ||
| use_dynamic_loss_scaling = scaler.get_use_dynamic_loss_scaling() |
Contributor
There was a problem hiding this comment.
scaler.get_use_dynamic_loss_scaling -> scaler.is_use_dynamic_loss_scaling
|
|
||
| Examples: | ||
| .. code-block:: python | ||
| import paddle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR types
New features
PR changes
APIs
Describe
Add get() and set() function for amp properties: