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

checking "transposed convolution" at beginning #3631

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

copyrightly
Copy link
Contributor

Summary:
Current check_convolution_args checks shapes of parameters before checking transposed. For a model using ConvTranspose2d, this may incur error like

executorch:tensor_util.h:655] Check failed (a.size(dim_a) == b.size(dim_b)): Tensors do not match: a.size(0) = 512 does not match b.size(0) = 1024

instead of showing "transposed convolution not supported yet." (see "ET CPU" in the test plan of D57258810).

The reason for getting the error above is due to the difference of shape of weight between ConvTranspose2d and Conv2d, specifically,

(in_channels, out_channels/groups, kernel_size[0], kernel_size[1])
(out_channels, in_channels/groups​, kernel_size[0], kernel_size[1])

so tensors_have_same_size_at_dims(bias.value(), 0, weight, 0)); may fail for ConvTranspose2d.

The error message would be more informative if we check transposed at the beginning.

Differential Revision: D57424572

Copy link

pytorch-bot bot commented May 16, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/3631

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (1 Unrelated Failure)

As of commit 3e3a6b8 with merge base ad419a5 (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 16, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57424572

Summary:

Current `check_convolution_args` checks shapes of parameters before checking `transposed`. For a model using `ConvTranspose2d`, this may incur error like
```
executorch:tensor_util.h:655] Check failed (a.size(dim_a) == b.size(dim_b)): Tensors do not match: a.size(0) = 512 does not match b.size(0) = 1024
```
instead of showing `"transposed convolution not supported yet."` (see "ET CPU" in the test plan of D57258810).

The reason for getting the error above is due to the difference of shape of `weight` between `ConvTranspose2d` and `Conv2d`, specifically,
- [shape of `weight` in `ConvTranspose2d` ](https://pytorch.org/docs/stable/generated/torch.nn.ConvTranspose2d.html) is (note that the first item is `in_channels`)
```
(in_channels, out_channels/groups, kernel_size[0], kernel_size[1])
```
- instead, [shape of `weight` in `Conv2d`](https://pytorch.org/docs/stable/generated/torch.nn.Conv2d.html) is (note that the first item is `out_channels`)
```
(out_channels, in_channels/groups​, kernel_size[0], kernel_size[1])
```
so [`tensors_have_same_size_at_dims(bias.value(), 0, weight, 0));`](https://www.internalfb.com/code/fbsource/[d34494a8af88b8c9742d00d62046d7884da47d7e]/fbcode/executorch/kernels/portable/cpu/util/kernel_ops_util.cpp?lines=314) may fail for `ConvTranspose2d`.

The error message would be more informative if we check `transposed` at the beginning.

Differential Revision: D57424572
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57424572

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants