Skip to content

Fix AffineQuantizedMinMaxObserver#4189

Open
Freed-Wu wants to merge 1 commit intopytorch:mainfrom
Freed-Wu:minmax
Open

Fix AffineQuantizedMinMaxObserver#4189
Freed-Wu wants to merge 1 commit intopytorch:mainfrom
Freed-Wu:minmax

Conversation

@Freed-Wu
Copy link

from torchao.quantization.observer import MappingType, AffineQuantizedMinMaxObserver
from torchao.quantization.granularity import PerAxis
import torch
o = AffineQuantizedMinMaxObserver(MappingType.ASYMMETRIC, torch.uint8, PerAxis(1))
_ = o(torch.tensor([[100, 120]]))
_ = o(torch.arange(8).reshape(1, 2, 2, 2))
print(o.min_val)

Expected:

tensor([[0, 4]])

Actual:

tensor([[100, 120]])

from torchao.quantization.observer import MappingType, AffineQuantizedMinMaxObserver
from torchao.quantization.granularity import PerAxis
import torch
o = AffineQuantizedMinMaxObserver(MappingType.ASYMMETRIC, torch.uint8, PerAxis(1))
_ = o(torch.tensor([[100, 120]]))
_ = o(torch.arange(8).reshape(1, 2, 2, 2))
print(o.min_val)

Expected:

tensor([[0, 4]])

Actual:

tensor([[100, 120]])
@pytorch-bot
Copy link

pytorch-bot bot commented Mar 27, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4189

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant