Skip to content

Commit

Permalink
[skip ci] fixing typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Anupam Bhatnagar committed Jan 13, 2022
1 parent 52d066a commit 39e7821
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fairscale/optim/layerwise_gradient_scaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ def _build_layer_info(self) -> List:

def scale(self) -> None:
"""
For each layer calculates the scaling factor for preceding layers' grad inputs
and current layers' grad outputs. These values are used to register a full backward
For each layer calculates the scaling factor for preceding layer's grad inputs
and current layer's grad outputs. These values are used to register a full backward
hook. The handle returned from registering the backward hook is appended to a list
of handles. New hooks are created and registered at every step and a new list of
handles is created. The handles are flushed out in the unscale function.
Expand Down Expand Up @@ -189,7 +189,7 @@ def _get_layers_with_finite_values(self) -> List[LayerInfo]:

def unscale(self) -> None:
"""
For each layer, check if any of the layers' parameters contain an inf/nan.
For each layer, check if any of the layer's parameters contain an inf/nan.
If there are no inf/nan in the gradient, then gradient of that layer is
unscaled by the reciprocal of the scaling factor for that layer.
Finally, all handles recorded while registering the hooks are deleted.
Expand All @@ -212,7 +212,7 @@ def _check_for_inf_or_nan(self) -> None:
"""
For each layer, check if any of the parameters with a gradient attribute
contain an inf/nan. If any of the parameters' gradient contain an inf/nan,
then that layers' found_inf_or_nan attribute is set to True and all
then that layer's found_inf_or_nan attribute is set to True and all
remaining parameters for that layer are skipped.
"""
for elt in self.layer_info:
Expand Down Expand Up @@ -246,7 +246,7 @@ def _update_scale(self) -> None:
of that layer by the backoff factor and set the growth tracker of that
layer to 0. Else, increment the growth tracker of the layer. If growth
tracker equals the growth interval, then multiply the scaling factor of
the layer by the growth factor and reset the layers' growth tracker to 0.
the layer by the growth factor and reset the layer's growth tracker to 0.
Finally, clip the scaling factor to the range
[self.min_scaling_factor, self.max_scaling_factor]. The min/max scaling
factor values are user configurable.
Expand Down

0 comments on commit 39e7821

Please sign in to comment.