[Frontend][Pytorch] Add axis N when maxpool3d layout is (C,D,H,W)#12467
Merged
masahi merged 2 commits intoapache:mainfrom Aug 18, 2022
Merged
[Frontend][Pytorch] Add axis N when maxpool3d layout is (C,D,H,W)#12467masahi merged 2 commits intoapache:mainfrom
masahi merged 2 commits intoapache:mainfrom
Conversation
f9e4925 to
63e0520
Compare
Contributor
Author
|
cc @masahi |
masahi
approved these changes
Aug 18, 2022
xinetzone
pushed a commit
to daobook/tvm
that referenced
this pull request
Nov 25, 2022
…ache#12467) * Add axis N if input is (C,D,H,W) layout. * Add (C,D,H,W) test case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
According to the pytorch doc torch.nn.MaxPool3d. The shape of input can be
(N,C,D,H,W) or (C,D,H,W). While the MaxPool3DAttrs thinks the dimension should be 5. When importing a model contains MaxPool3d with shape (C,D,H,W)`,tvm/include/tvm/relay/attrs/nn.h
Lines 985 to 996 in bcc7cde
which could leads to out of bound error
Check failed: (0 <= i && i < p->size_) is false: IndexError: indexing 4 on an array of size 4whenii == 4 and dshape == 4.tvm/src/relay/op/nn/pooling.cc
Lines 1211 to 1216 in bcc7cde
Therefore, I simply add an expand_dims op on the frontend to avoid this situation.