Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generic analog optimizer #242

Merged
merged 4 commits into from
Jun 4, 2021

Conversation

diego-plan9
Copy link
Member

Related issues

#48

Description

Add a mechanism for "enhancing" a regular Optimizer for using it in an analog context (customizing the optimization step for triggering the analog update needed for analog tiles), as aihwkit.optim.AnalogOptimizer:

from torch.optim import SGD
from torch.nn import Linear

from aihwkit.simulator.configs import InferenceRPUConfig
from aihwkit.optim import AnalogOptimizer


model = AnalogLinear(3, 4, rpu_config=InferenceRPUConfig)
optimizer = AnalogOptimizer(SGD, model.parameters(), lr=0.02)

The new optimizer behaves like the regular optimizer (which is passed as the first parameter to the constructor).

Details

As part of the changes:

  • AnalogContext has been moved to aihwkit.optim
  • AnalogSGD has been redefined in the terms of the newly introduced constructs, still keeping the original class in the package for convenience.

Kudos and thanks to @maljoras for the joint collaboration on this PR!

@diego-plan9 diego-plan9 merged commit f9318d4 into IBM:master Jun 4, 2021
@diego-plan9 diego-plan9 deleted the feature/analog-optimizer branch June 4, 2021 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants