-
Notifications
You must be signed in to change notification settings - Fork 859
Arm backend: Add FP16 tests of models (mv3, ic3) #17586
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,11 @@ | |
| mv3 = models.mobilenet_v3_small(weights=models.MobileNet_V3_Small_Weights) | ||
| mv3 = mv3.eval() | ||
|
|
||
| mv3_fp16 = models.mobilenet_v3_small(weights=models.MobileNet_V3_Small_Weights).to( | ||
| torch.float16 | ||
| ) | ||
| mv3_fp16 = mv3_fp16.eval() | ||
|
|
||
|
Comment on lines
+27
to
+31
|
||
| normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) | ||
|
|
||
| input_tensor = torch.rand(1, 3, 232, 232) | ||
|
|
@@ -40,6 +45,20 @@ def test_mv3_tosa_FP(): | |
| pipeline.run() | ||
|
|
||
|
|
||
| @pytest.mark.slow | ||
| def test_mv3_tosa_FP_fp16(): | ||
| inputs_fp16 = tuple(t.to(torch.float16) for t in model_inputs) | ||
| pipeline = TosaPipelineFP[input_t]( | ||
| mv3_fp16, | ||
| inputs_fp16, | ||
| aten_op=[], | ||
| exir_op=[], | ||
| use_to_edge_transform_and_lower=True, | ||
| atol=5e-2, | ||
| ) | ||
| pipeline.run() | ||
|
|
||
|
|
||
| @pytest.mark.slow | ||
| def test_mv3_tosa_INT(): | ||
| pipeline = TosaPipelineINT[input_t]( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ic3_fp16is instantiated and converted at import time, which forces a second model construction + weight load even when the FP16 test isn’t selected. Consider creating the FP16 model insidetest_ic3_tosa_FP_fp16()(or via a cached pytest fixture) to reduce test import time and memory usage.