-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AlterLayout] NCHWc upsampling, fix depthwise conv #2806
Conversation
61fedff
to
5776ccd
Compare
const Array<Layout>& old_in_layouts, | ||
const Array<Array<IndexExpr>> &old_in_shapes) { | ||
// NOTE: Discard "const" qualifier here. | ||
T *params = const_cast<T*>(attrs.as<T>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain why this is necessary? It's quite counterintuitive why this kind of thing is needed, since the desired behaviour is essentially "if input layout is NCHWc, then expect input in NCHWc, perform compute, and output in NCHWc" right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is same to: https://github.com/dmlc/tvm/blob/master/src/relay/op/nn/pooling.cc#L22
In order to invoke AlterLayout Pass, we need FInferCorrectLayout
attr, which is this function. This is part of logic of current AlterLayoutPass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some test cases?
6fb25d8
to
f569e03
Compare
Added |
f569e03
to
29b7489
Compare
29b7489
to
a6844de
Compare
4bec5f0
to
c2c9ae5
Compare
bd259cc
to
5bcd6a0
Compare
a0b4515
to
03c8f5e
Compare
@yzhliu For the failed test, I am able to pass on local machine. Could you help take a look? |
I guess the failed test is not for cpu? |
Not really: https://github.com/dmlc/tvm/blob/master/topi/tests/python/test_topi_depthwise_conv2d.py#L311 |
03c8f5e
to
521e94a
Compare
521e94a
to
04a450a
Compare
04a450a
to
3655aa0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can merge as long as CI is happy.
@tqchen Docker test issue appears again. Could you clean up cache? |
3655aa0
to
692b4c0
Compare
I agree with @ajtulloch that the AlterLayout function can cause some confusion, perhaps we could do an RFC discussion about the mechanism and clarify more in the comments. I am also not sure why const discard is necessarily here @yzhliu @merrymercy can you explain? Of course, the discussion does not have to block this PR since it fixes some problem |
7d3e4ee
to
ee141a2
Compare
ee141a2
to
63c4e2e
Compare
Thanks @antinucleon @yzhliu @ajtulloch @tqchen , the CI has passed, so this is merged. |
* [AlterLayout] NCHW upsampling * [Relay][Pass] Fix Depthwise AlterLayout
* [AlterLayout] NCHW upsampling * [Relay][Pass] Fix Depthwise AlterLayout
* [AlterLayout] NCHW upsampling * [Relay][Pass] Fix Depthwise AlterLayout
Support NCHWc upsamping.