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: us...@infra.apache.org With regards, Apache Git Services