You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -144,7 +144,8 @@ Here is a ready to use Adam implementation through overwriting :code:`_update` u
144
144
bias_correction2 = [1- i**self.current_step for i in beta2]
145
145
146
146
denom = torch._foreach_sqrt(exp_avg_sq)
147
-
torch._foreach_div_(denom, [c **0.5+ e for c, e inzip(bias_correction2, eps)])
147
+
torch._foreach_div_(denom, [c **0.5for c in bias_correction2])
148
+
torch._foreach_add_(denom, eps)
148
149
149
150
ret = torch._foreach_div(exp_avg, denom)
150
151
torch._foreach_mul_(ret, [a/d for a,d inzip(alpha, bias_correction1)])
@@ -159,6 +160,6 @@ Method 3. Overwriting step
159
160
+++++++++++++++++++++++++++++++++++++++++++++
160
161
:code:`step` method gives you the most control, but it requires the most understanding of the internals of torchzero. You can reevaluate the closure multiple times which is usually necessary for line searches and gradient approximation. You can step with multiple modules, skip an update, update parameters directly, basically anything is possible.
161
162
162
-
There are also helper classes: :py:mod:`GradientApproximatorBase<tz.modules.gradient_approximation.GradientApproximatorBase>` allows you to define a gradient approximation module in a more convenient way by overwriting :code:`_make_ascent` method. :py:mod:`GradientApproximatorBase<tz.modules.line_search.LineSearchBase>` is an easy way to define line searches by overwriting :code:`_find_best_lr`. I will be making a tutorial on those soon.
163
+
There are also helper classes: :py:mod:`GradientApproximatorBase<tz.modules.gradient_approximation.GradientApproximatorBase>` allows you to define a gradient approximation module in a more convenient way by overwriting :code:`_make_ascent` method. :py:mod:`GradientApproximatorBase<tz.modules.line_search.LineSearchBase>` is an easy way to define line searches by overwriting :code:`_find_best_lr`.
0 commit comments