mshr-h commented on code in PR #18550:
URL: https://github.com/apache/tvm/pull/18550#discussion_r2594466635
##########
tests/python/relax/test_frontend_from_exported_program.py:
##########
@@ -4900,6 +4900,30 @@ def main(
verify_model(InterpolateBilinearAA(), example_args, {},
expected_bilinear_aa)
[email protected]("mode", ["nearest", "bilinear", "bicubic"])
[email protected]("scale_factor", [2.0, [2.0, 3.0]])
+def test_interpolate_scale_factor_list(mode, scale_factor):
+ """Test interpolation with both scalar and list scale_factor values."""
+
+ class Interpolate(Module):
+ def __init__(self, mode, scale_factor):
+ super().__init__()
+ self.mode = mode
+ self.scale_factor = scale_factor
+
+ def forward(self, input):
+ kwargs = {"scale_factor": self.scale_factor, "mode": self.mode}
+ # align_corners is only used for bilinear and bicubic modes
+ if self.mode in ["bilinear", "bicubic"]:
+ kwargs["align_corners"] = False
+ return torch.nn.functional.interpolate(input, **kwargs)
+
+ # Test with 32x32 input
+ example_args = (torch.randn(1, 3, 32, 32, dtype=torch.float32),)
+ model = Interpolate(mode, scale_factor)
+ verify_model_numerically(model, example_args, rtol=1e-5, atol=1e-5)
Review Comment:
Would be better to avoid E2E tests as much as possible because they
increased CI pressure.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]