When initializing the "AdamW" optimizer, property "amsgrad" is used before it is defined. Therefore the following code generates error: AttributeError: 'AdamW' object has no attribute 'amsgrad'.
import brainpy as bp
import brainpy.math as bm
weights = {'weight': bm.TrainVar(bm.zeros(10))}
optimizer = bp.optim.AdamW(lr=0.01, train_vars=weights)
This PR fixes this error.
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist
[x] Code follows the code style of this project.
[x] Changes follow the CONTRIBUTING guidelines.
[x] Update necessary documentation accordingly.
[x] Lint and tests pass locally with the changes.
[x] Check issues and pull requests first. You don't want to duplicate effort.
When initializing the "AdamW" optimizer, property "amsgrad" is used before it is defined. Therefore the following code generates error:
AttributeError: 'AdamW' object has no attribute 'amsgrad'
.This PR fixes this error.
Types of changes
Checklist