Skip to content

Commit

Permalink
Fix a doctest error with param_rename dictionary
Browse files Browse the repository at this point in the history
Summary: One of the doc tests was failing (https://github.com/pytorch/opacus/actions/runs/11511705096/job/32045564214) becaue the list being iterated on was modified in the run. Fixed this bug.

Differential Revision: D65003266
  • Loading branch information
EnayatUllah authored and facebook-github-bot committed Oct 30, 2024
1 parent b5d53f2 commit d9c1671
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion opacus/layers/param_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def _register_renamed_parameters(self):
self.parameters() proceeds recursively from the top, going into submodules after processing
items at the current level, and will not return duplicates.
"""
for old_name, param in super().named_parameters():

for old_name, param in list(super().named_parameters()):
if old_name in self.old_to_new:
new_name = self.old_to_new[old_name]
self.register_parameter(new_name, param)
Expand Down

0 comments on commit d9c1671

Please sign in to comment.