Skip to content

Commit

Permalink
fix: Reverse update logic within bp_v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Lifann committed Mar 10, 2023
1 parent e450ef4 commit b0d7676
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def apply_grad_to_update_var(var, grad):
if isinstance(var, de.shadow_ops.ShadowVariable):
v0 = var.read_value(do_prefetch=False)
else:
v0 = var.read_value(do_prefetch=not var.params.bp_v2)
v0 = var.read_value(do_prefetch=var.params.bp_v2)
s0 = [_s.read_value() for _s in _slots]
_before = [v0] + s0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def update_op(self, optimizer, g):
if isinstance(self._v, de.shadow_ops.ShadowVariable):
v0 = self._v.read_value(do_prefetch=False)
else:
v0 = self._v.read_value(do_prefetch=not self._v.params.bp_v2)
v0 = self._v.read_value(do_prefetch=self._v.params.bp_v2)
s0 = [_s.read_value() for _s in _slots]
_before = [v0] + s0

Expand Down

0 comments on commit b0d7676

Please sign in to comment.