Skip to content
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

[Relay] conv3d depthwise bug fix #16151

Merged
merged 5 commits into from Nov 23, 2023
Merged

[Relay] conv3d depthwise bug fix #16151

merged 5 commits into from Nov 23, 2023

Conversation

jonghewk
Copy link
Contributor

Issue

Relay for depthwise nn.conv3d causes error.

Cause

depthwise is not fully implemented for conv3d.
The pytorch frontend takes care of the depthwise case and reshapes the weights.
(https://github.com/apache/tvm/blob/main/python/tvm/relay/frontend/pytorch.py#L1247).
However, this is not taken care in Conv3DRel.

Note that Conv2DRel takes care of this case.
(https://github.com/apache/tvm/blob/main/src/relay/op/nn/convolution.cc#L273)

How to reproduce

class Conv3d(nn.Module):
    def __init__(self):
        super(Conv3d, self).__init__()
        self.conv = nn.Conv3d(16, 32, kernel_size=1, groups=16)
    
    def forward(self, x):
        x = self.conv(x)
        return x

from tvm import relay
s = [1, 16, 10, 10, 10]
net = Conv3d()
input_data = torch.randn(s)
scripted_model = torch.jit.trace(net, input_data).eval()
mod = relay.frontend.from_pytorch(scripted_model, [("x", s)]) 

@jonghewk
Copy link
Contributor Author

@masahi Any chance of reviewing this?

@masahi
Copy link
Member

masahi commented Nov 22, 2023

Can you add your PT test as a test case?

@jonghewk
Copy link
Contributor Author

Can you add your PT test as a test case?

Done.

@masahi masahi merged commit 1a2cc18 into apache:main Nov 23, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants