Lyken17 opened a new pull request #10439:
URL: https://github.com/apache/tvm/pull/10439
Current backward impl raises error for nn.Conv2d, either normal conv or
depth-wise conv. See the code attached below.
```python
import numpy as np
import tvm
from tvm import relay
from tvm.contrib import graph_executor
normal_conv_code = """
fn (%input0: Tensor[(1, 3, 32, 32), float32], %v0_weight: Tensor[(3, 1, 3,
3), float32], %v0_bias: Tensor[(3), float32]) {
%0 = nn.conv2d(%input0, %v0_weight, padding=[1, 1, 1, 1], groups=3,
channels=3, kernel_size=[3, 3]);
nn.bias_add(%0, %v0_bias)
}
"""
depthwise_conv_code = """
fn (%input0: Tensor[(1, 3, 32, 32), float32], %v0_weight: Tensor[(3, 3, 3,
3), float32], %v0_bias: Tensor[(3), float32]) {
%0 = nn.conv2d(%input0, %v0_weight, padding=[1, 1, 1, 1], groups=1,
channels=3, kernel_size=[3, 3]);
nn.bias_add(%0, %v0_bias)
}
"""
SEMVER = '#[version = "0.0.5"]\n'
expr = tvm.parser.parse_expr(SEMVER + normal_conv_code)
fmod = tvm.IRModule.from_expr(expr)
mod = relay.transform.InferType()(fmod)
bwd_expr = relay.transform.gradient(mod["main"], mode="first_order")
bwd_mod = tvm.IRModule.from_expr(bwd_expr)
bwd_mod = relay.transform.InferType()(bwd_mod)
```
This PR aims to roll back the impl to previous version while fixing the bug
for depth-wise (previous backward does not work for depth-wise conv).
Thanks for contributing to TVM! Please refer to guideline
https://tvm.apache.org/docs/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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]