masahi commented on a change in pull request #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map URL: https://github.com/apache/incubator-tvm/pull/4961#discussion_r385946326
########## File path: tests/python/frontend/pytorch/test_forward.py ########## @@ -677,9 +666,29 @@ def forward(self, *args): chunks = args[0].chunk(7, 2) return torch.cat(chunks, 2) - with torch.no_grad(): - input_data = torch.rand(input_shape).float() - verify_model(Chunk1().float().eval(), input_data=input_data) + input_data = torch.rand(input_shape).float() + verify_model(Chunk1().float().eval(), input_data=input_data) + +def test_upsample(): + class Upsample(nn.Module): + def __init__(self, size=None, scale=None, + mode="nearest", align_corners=None): + super().__init__() + self.size = size + self.scale = scale + self.mode = mode + self.align_corners = align_corners + + def forward(self, x): + return nn.functional.interpolate(x, size=self.size, + scale_factor=self.scale, + mode=self.mode, + align_corners=self.align_corners) + inp = torch.rand((1, 3, 32, 32)) + verify_model(Upsample(size=(64, 64), mode="nearest"), inp) + verify_model(Upsample(scale=2, mode="nearest"), inp) + verify_model(Upsample(size=(64, 64), mode="bilinear", align_corners=True), inp) + verify_model(Upsample(scale=2, mode="bilinear", align_corners=True), inp) Review comment: added ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services