Skip to content

[test] Refactor test_quant_api to use shared ToyTwoLinearModel#4236

Open
abhinav-TB wants to merge 2 commits intopytorch:mainfrom
abhinav-TB:refactor/toy-model-test-quant-api
Open

[test] Refactor test_quant_api to use shared ToyTwoLinearModel#4236
abhinav-TB wants to merge 2 commits intopytorch:mainfrom
abhinav-TB:refactor/toy-model-test-quant-api

Conversation

@abhinav-TB
Copy link
Copy Markdown

Summary

Refactors test/quantization/test_quant_api.py to use the shared model architecture from torchao.testing.model_architectures instead of a local inline toy model.

What changed

  • Removed local ToyLinearModel definition in test/quantization/test_quant_api.py
  • Imported ToyTwoLinearModel from torchao.testing.model_architectures
  • Added _make_toy_linear_model(...) helper in the test file to preserve existing test ergonomics while mapping:
    • old args: (m, n, k, bias, dtype, device)
    • new args: (input_dim, hidden_dim, output_dim, has_bias, dtype, device)
  • Updated all usages in this file to call _make_toy_linear_model(...)
  • Ensured constructor calls pass explicit dtype and device where needed

Why

This is an incremental step for #2078 to reduce duplicated toy model definitions and standardize on shared testing architectures, while keeping PR scope small and reviewable.

@abhinav-TB abhinav-TB requested a review from jerryzh168 as a code owner April 3, 2026 16:48
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Apr 3, 2026

🔗 Helpful Links

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

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.

@abhinav-TB abhinav-TB requested a review from vkuzo as a code owner April 3, 2026 16:48
@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 Apr 3, 2026
@abhinav-TB abhinav-TB requested a review from jerryzh168 April 3, 2026 17:22
@abhinav-TB
Copy link
Copy Markdown
Author

@jerryzh168 , can you review the PR again

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.

2 participants