Catalog PyPI
Back to packageRELEASE DETAILS

0.1.0

PyPI

afor-optimizer

Adaptive Forgetting Optimizer for PyTorch

adaptive-optimizationdeep-learningmachine-learningoptimizerpytorch
Published14 Sept 2026
Direct dependencies1
Transitive dependenciesNot calculated

README

Version 0.1.0 documentation

AFOR

AFOR is a tensor-wise adaptive forgetting optimizer for PyTorch. It adapts the second-moment decay coefficient from local gradient residuals, direction consistency, and online Z-score normalization.

Installation

pip install afor-optimizer

Usage

import torch
from AFOR import afor

model = torch.nn.Linear(10, 2)
optimizer = afor(
    model.parameters(),
    lr=1e-3,
    betas=(0.9, 0.999),
    beta2_min=0.99,
    dir_weight=1.0,
    weight_decay=1e-4,
)

inputs = torch.randn(16, 10)
targets = torch.randint(0, 2, (16,))
loss = torch.nn.functional.cross_entropy(model(inputs), targets)
loss.backward()
optimizer.step()
optimizer.zero_grad()

Main Parameters

  • lr: learning rate.
  • betas: first-moment and initial second-moment coefficients.
  • beta2_min: lower bound for the adaptive second-moment coefficient.
  • dir_weight: weight of gradient-direction consistency.
  • eps: numerical stability term.
  • weight_decay: decoupled weight decay.
  • fast_ref: use the larger fast/slow noise estimate as the noise reference.

AFOR currently supports dense gradients only.

License

Released under the MIT License. See LICENSE.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 1

Native requirements
1 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
torch
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
torch>=2.0runtime

Distribution files

2 collected
afor_optimizer-0.1.0-py3-none-any.whl

bdist_wheel · 4.66 KB · Python py3

Source file
afor_optimizer-0.1.0.tar.gz

sdist · 4.5 KB · Python source

Source file

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:10 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:27c4a577f0f034ddf4a2a4095ca3aac9cc43703f9a21bacac148ebcc4c10b8c8

Other collected versions

View all collected versions →