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 2022/01/30 20:52:38 UTC
[GitHub] [tvm] lazycal opened a new issue #10109: [Bug] AlterOpLayout failed on Conv->Transpose->Conv
lazycal opened a new issue #10109:
URL: https://github.com/apache/tvm/issues/10109

```python
import tvm
from tvm import relay
import numpy as np
x = relay.var("x", shape=(1, 1, 24, 48))
w1 = relay.const(np.random.uniform(size=(1, 1, 1, 1)))
w2 = relay.const(np.random.uniform(size=(1, 1, 1, 1)))
y = relay.nn.conv2d(x, w1, kernel_size=(1, 1), padding=(0, 0), channels=1)
y = relay.transpose(y, (0, 1, 3, 2))
z = relay.nn.conv2d(y, w2, kernel_size=(1, 1), padding=(0, 0), channels=1)
func = relay.Function([x], z)
mod = tvm.IRModule.from_expr(func)
print(mod)
# with tvm.transform.PassContext(opt_level=3, disabled_pass=["AlterOpLayout"]):
with tvm.transform.PassContext(opt_level=3):
res = relay.build_module.create_executor('graph', mod, target='llvm', device=tvm.cpu()).evaluate()(
np.random.uniform(size=(1, 1, 24, 48)).astype(np.float32))
print(res)
```
The above model first does a conv, then a transpose that swap H and W dimension, and finally conv again. It fails with error
```
One or more operators have not been tuned. Please tune your model for better performance. Use DEBUG logging level to see more details.
The Relay type checker is unable to show the following types match:
Tensor[(1, 1, 24, 48), float32]
Tensor[(1, 1, 48, 24), float32]
```
The root cause is similar to https://discuss.tvm.apache.org/t/pytorch-layout-cannot-convert-f-linear-x-f-linear-y-z/10866. In short, during alteroplayout pass, each dimension is assumed to be associated with a specific semantic (e.g., `H`, `W`, `O`, `I`, ...), and when this assumption is broken, the pass will be fragile.
### Environment
OS: ubuntu 1804
TVM: 6a274af9cb4e7baf6d9dd06f0fb38bea5ac3154a
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] masahi closed issue #10109: [Bug] AlterOpLayout failed on Conv->Transpose->Conv
Posted by GitBox <gi...@apache.org>.
masahi closed issue #10109:
URL: https://github.com/apache/tvm/issues/10109
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org