You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/02/28 03:11:54 UTC
[GitHub] [incubator-tvm] masahi opened a new pull request #4961: [Relay,
Torch] Add upsampling op support and enable registering a user defined op
conversion map
masahi opened a new pull request #4961: [Relay, Torch] Add upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961
Thanks for contributing to TVM! Please refer to guideline https://docs.tvm.ai/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @ them in the pull request thread.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] leandron commented on issue #4961: [Torch]
Upsampling op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
leandron commented on issue #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#issuecomment-592512021
On a quick look, *it seems* it is behaving as expected by `task_sphinx_precheck.sh`. It is not a CI unexpected crash.
`task_sphinx_precheck.sh` found warnings during Sphinx execution and it is exiting with status 1 (non-zero), so it fails the Jenkins pipeline.
The relevant lines are:
https://github.com/apache/incubator-tvm/blob/7ccb4363eefa76ae355ee263aa5527d43fb699fb/tests/scripts/task_sphinx_precheck.sh#L43-L46
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] jwfromm commented on a change in pull request
#4961: [Torch] Upsampling op support and enable registering a user defined
op conversion map
Posted by GitBox <gi...@apache.org>.
jwfromm 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_r385830597
##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -614,6 +615,51 @@ def _impl(inputs, input_types):
return _op.tensor.sqrt(data)
return _impl
+def _floor():
+ def _impl(inputs, input_types):
+ data = inputs[0]
+ return _op.floor(data)
+ return _impl
+
+def _to():
+ def _impl(inputs, input_types):
+ data = inputs[0]
+ # special handling for aten::to(data, 6, _, _, _) case
+ # 6 means dtype = float
+ # this happens when converting upsampling with scale factor
+ cast_func = {
+ 6: float,
+ }
+ if inputs[1] in cast_func and not isinstance(data, _expr.Expr):
Review comment:
This seems very specific, it looks like it only works for non expression inputs and casts to floats. Is there any reason not to add a `relay.cast` fallback for expression inputs and support other datatypes in the cast_func lookup?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on issue #4961: [Torch] Upsampling
op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
masahi commented on issue #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#issuecomment-592336399
@tqchen @comaniac other PRs are blocked by the same CI error.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on issue #4961: [Torch] Upsampling
op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
masahi commented on issue #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#issuecomment-592851092
@vinx13 @anijain2305 @icemelon9 comments are addressed and tests passed, I think it is ready for merge. A custom convert map could be of interest to other frontends.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] alexwong commented on a change in pull request
#4961: [Torch] Upsampling op support and enable registering a user defined
op conversion map
Posted by GitBox <gi...@apache.org>.
alexwong 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_r385913650
##########
File path: tests/python/frontend/pytorch/test_forward.py
##########
@@ -23,6 +23,7 @@
from scipy.stats import t as tdistr
import numpy as np
import torch
+from torch import nn
Review comment:
Nitpick: There's places where we use torch.nn and others where we use nn, can we change the former to the latter and remove the import below this one?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi edited a comment on issue #4961: [Torch]
Upsampling op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
masahi edited a comment on issue #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#issuecomment-592299187
@tqchen @comaniac I get an error from sphinx issues which is not related to this PR, can you take a look? https://ci.tvm.ai/blue/organizations/jenkins/tvm/detail/PR-4961/1/pipeline/150
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on a change in pull request #4961:
[Torch] Upsampling op support and enable registering a user defined op
conversion map
Posted by GitBox <gi...@apache.org>.
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_r385963791
##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -614,6 +615,51 @@ def _impl(inputs, input_types):
return _op.tensor.sqrt(data)
return _impl
+def _floor():
+ def _impl(inputs, input_types):
+ data = inputs[0]
+ return _op.floor(data)
+ return _impl
+
+def _to():
+ def _impl(inputs, input_types):
+ data = inputs[0]
+ # special handling for aten::to(data, 6, _, _, _) case
+ # 6 means dtype = float
+ # this happens when converting upsampling with scale factor
+ cast_func = {
+ 6: float,
+ }
+ if inputs[1] in cast_func and not isinstance(data, _expr.Expr):
Review comment:
yeah, the problem is `aten::to(...)` is overloaded for different purpose (transfer to cpu/cuda or simple type cast). See my last commit https://github.com/apache/incubator-tvm/pull/4961/commits/f070d22fdb479c82160cf642e29453472e83c61e
Does this look better?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi merged pull request #4961: [Torch]
Upsampling op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
masahi merged 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
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] leandron edited a comment on issue #4961: [Torch]
Upsampling op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
leandron edited a comment on issue #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#issuecomment-592512021
On a quick look, *it seems* it is behaving as expected by `task_sphinx_precheck.sh`. It is not a CI unexpected crash.
`task_sphinx_precheck.sh` found warnings during Sphinx execution and it is exiting with status 1 (non-zero), so it fails the Jenkins pipeline.
The warnings are not introduced by your change, so it seems we need a pre-patch fixing docs, in order to unblock the build for this new check, introduced recently.
The relevant lines are:
https://github.com/apache/incubator-tvm/blob/7ccb4363eefa76ae355ee263aa5527d43fb699fb/tests/scripts/task_sphinx_precheck.sh#L43-L46
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] jwfromm commented on a change in pull request
#4961: [Torch] Upsampling op support and enable registering a user defined
op conversion map
Posted by GitBox <gi...@apache.org>.
jwfromm 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_r385832926
##########
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:
Probably worth adding a bilinear test with non integer scaling, i.e. `size = (50, 50)`.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] comaniac commented on issue #4961: [Torch]
Upsampling op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
comaniac commented on issue #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#issuecomment-592302836
I saw these errors before but have no idea how were they resolved. Could you rebase to upstream master to see if errors persist?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] tqchen commented on issue #4961: [Torch] Upsampling
op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
tqchen commented on issue #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#issuecomment-592647164
docs error should be fixed by https://github.com/apache/incubator-tvm/pull/4967
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] leandron commented on issue #4961: [Torch]
Upsampling op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
leandron commented on issue #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#issuecomment-592515583
Discussion about fixing docs is happening in #4908.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on a change in pull request #4961:
[Torch] Upsampling op support and enable registering a user defined op
conversion map
Posted by GitBox <gi...@apache.org>.
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_r385942736
##########
File path: tests/python/frontend/pytorch/test_forward.py
##########
@@ -23,6 +23,7 @@
from scipy.stats import t as tdistr
import numpy as np
import torch
+from torch import nn
Review comment:
Removed `from torch import nn` and updated to use `torch.nn`
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi edited a comment on issue #4961: [Torch]
Upsampling op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
masahi edited a comment on issue #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#issuecomment-592299187
@tqchen @comaniac I get an error from sphinx issues which is not related to this PR, can you take a look? It seems this comes from `task_sphinx_precheck.sh` that you added earlier.
https://ci.tvm.ai/blue/organizations/jenkins/tvm/detail/PR-4961/1/pipeline/150
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] alexwong commented on a change in pull request
#4961: [Torch] Upsampling op support and enable registering a user defined
op conversion map
Posted by GitBox <gi...@apache.org>.
alexwong 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_r385913650
##########
File path: tests/python/frontend/pytorch/test_forward.py
##########
@@ -23,6 +23,7 @@
from scipy.stats import t as tdistr
import numpy as np
import torch
+from torch import nn
Review comment:
Nitpick: There's places where we use torch.nn and others where we use nn, can we change the former to the latter and remove the below import as well.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] jwfromm commented on a change in pull request
#4961: [Torch] Upsampling op support and enable registering a user defined
op conversion map
Posted by GitBox <gi...@apache.org>.
jwfromm 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_r386006434
##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -614,6 +615,51 @@ def _impl(inputs, input_types):
return _op.tensor.sqrt(data)
return _impl
+def _floor():
+ def _impl(inputs, input_types):
+ data = inputs[0]
+ return _op.floor(data)
+ return _impl
+
+def _to():
+ def _impl(inputs, input_types):
+ data = inputs[0]
+ # special handling for aten::to(data, 6, _, _, _) case
+ # 6 means dtype = float
+ # this happens when converting upsampling with scale factor
+ cast_func = {
+ 6: float,
+ }
+ if inputs[1] in cast_func and not isinstance(data, _expr.Expr):
Review comment:
Ah I didn't know it was overloaded for device copies. This does look much better though, thanks!
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] anijain2305 commented on a change in pull request
#4961: [Torch] Upsampling op support and enable registering a user defined
op conversion map
Posted by GitBox <gi...@apache.org>.
anijain2305 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_r386057076
##########
File path: tests/python/frontend/pytorch/test_forward.py
##########
@@ -730,6 +752,55 @@ def test_vgg11_bn():
"""
+def test_custom_conversion_map():
+ def get_roi_align():
+ pool_size = 5
+ n_channels = 2 * (pool_size ** 2)
+ x = torch.rand(2, n_channels, 10, 10)
+ rois = torch.tensor([[0, 0, 0, 9, 9], # format is (xyxy)
+ [0, 0, 5, 4, 9],
+ [0, 5, 5, 9, 9],
+ [1, 0, 0, 9, 9]], dtype=torch.float)
+ roi_align = torchvision.ops.RoIAlign(pool_size, spatial_scale=1,
+ sampling_ratio=-1)
+ return roi_align.eval(), [x, rois]
+
+ def convert_roi_align():
+ def _impl(inputs, input_types):
+ spatial_scale = inputs[2]
+ pooled_size = (inputs[3], inputs[4])
+ sampling_ratio = inputs[5]
+ return relay.op.vision.roi_align(inputs[0], inputs[1],
+ pooled_size, spatial_scale,
+ sampling_ratio)
+ return _impl
+
+ custom_map = {'torchvision::roi_align': convert_roi_align()}
+ model, inputs = get_roi_align()
+
+ verify_model(model, inputs, custom_map)
+
+
+def test_segmentaton_models():
+ class SegmentationModelWrapper(Module):
+ def __init__(self, model):
+ super().__init__()
+ self.model = model
+
+ def forward(self, inp):
+ out = self.model(inp)
+ return out["out"]
+
+ fcn = torchvision.models.segmentation.fcn_resnet101(pretrained=True)
+ deeplab = torchvision.models.segmentation.deeplabv3_resnet101(pretrained=True)
+
+ inp = [torch.rand((1, 3, 300, 300), dtype=torch.float)]
+
+ for model in [fcn, deeplab]:
+ verify_model(SegmentationModelWrapper(model.eval()), inp,
+ ctx_list=[("cuda", tvm.gpu(0))]) # dilated covolution not supported on x86
Review comment:
Maybe adding the issue number is helpful here?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on issue #4961: [Torch] Upsampling
op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
masahi commented on issue #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#issuecomment-592303313
It is already rebased to the latest commit. The error is still there.
https://github.com/masahi/tvm/commits/torch-more-operators
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on issue #4961: [Torch] Upsampling
op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
masahi commented on issue #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#issuecomment-592299187
@tqchen I get an error from sphinx issues which is not related to this PR, can you take a look? https://ci.tvm.ai/blue/organizations/jenkins/tvm/detail/PR-4961/1/pipeline/150
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on issue #4961: [Torch] Upsampling
op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
masahi commented on issue #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#issuecomment-592753364
@alexwong @jwfromm I removed the dependency on `packaging` and dropped support for PT 1.2 and older per discussion https://discuss.tvm.ai/t/pytorch-frontend-no-module-named-packaging/5829.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] jwfromm commented on issue #4961: [Torch]
Upsampling op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
jwfromm commented on issue #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#issuecomment-592646686
Left minor comments but otherwise looks good. Having a custom convert map is a neat idea that I'd like to see added to other frontends.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] comaniac commented on issue #4961: [Torch]
Upsampling op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
comaniac commented on issue #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#issuecomment-592643432
Yes. It is due to the doc checker introduced yesterday. I'm looking into the problem now.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on a change in pull request #4961:
[Torch] Upsampling op support and enable registering a user defined op
conversion map
Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] masahi commented on issue #4961: [Torch] Upsampling
op support and enable registering a user defined op conversion map
Posted by GitBox <gi...@apache.org>.
masahi commented on issue #4961: [Torch] Upsampling op support and enable registering a user defined op conversion map
URL: https://github.com/apache/incubator-tvm/pull/4961#issuecomment-593024453
Thanks @jwfromm @alexwong @anijain2305
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services