-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Make Conv{1,2,3}dOptions and ConvTranspose{1,2,3}dOptions different classes #31005
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
Conversation
facebook-github-bot
left a comment
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.
@yf225 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
facebook-github-bot
left a comment
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.
@yf225 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
…lasses (#31005) Summary: Currently, both `Conv{1,2,3}dOptions` and `ConvTranspose{1,2,3}dOptions` are aliases of the `ConvOptions<{1,2,3}>` class, which causes confusion because the `ConvOptions` class has parameters such as `transposed` that shouldn't be exposed to the end user. (This has caused issues such as #30931.) This PR makes the following improvements: 1. Rename the original `torch::nn::ConvOptions<N>` class to `torch::nn::detail::ConvNdOptions<N>` class, to signify that it's an implementation detail and should not be used publicly. 2. Create new classes `torch::nn::ConvOptions<N>` and `torch::nn::ConvTransposeOptions<N>`, which have parameters that exactly match the constructor of `torch.nn.Conv{1,2,3}d` and `torch.nn.ConvTranspose{1,2,3}d` in Python API. Pull Request resolved: #31005 Differential Revision: D18898048 Pulled By: yf225 fbshipit-source-id: 7663d646304c8cb004ca7f4aa4e70d3612c7bc75
…lasses (#31005) Summary: Currently, both `Conv{1,2,3}dOptions` and `ConvTranspose{1,2,3}dOptions` are aliases of the `ConvOptions<{1,2,3}>` class, which causes confusion because the `ConvOptions` class has parameters such as `transposed` that shouldn't be exposed to the end user. (This has caused issues such as #30931.) This PR makes the following improvements: 1. Rename the original `torch::nn::ConvOptions<N>` class to `torch::nn::detail::ConvNdOptions<N>` class, to signify that it's an implementation detail and should not be used publicly. 2. Create new classes `torch::nn::ConvOptions<N>` and `torch::nn::ConvTransposeOptions<N>`, which have parameters that exactly match the constructor of `torch.nn.Conv{1,2,3}d` and `torch.nn.ConvTranspose{1,2,3}d` in Python API. Pull Request resolved: #31005 Differential Revision: D18898048 Pulled By: yf225 fbshipit-source-id: 7663d646304c8cb004ca7f4aa4e70d3612c7bc75
…lasses (pytorch#31005) Summary: Currently, both `Conv{1,2,3}dOptions` and `ConvTranspose{1,2,3}dOptions` are aliases of the `ConvOptions<{1,2,3}>` class, which causes confusion because the `ConvOptions` class has parameters such as `transposed` that shouldn't be exposed to the end user. (This has caused issues such as pytorch#30931.) This PR makes the following improvements: 1. Rename the original `torch::nn::ConvOptions<N>` class to `torch::nn::detail::ConvNdOptions<N>` class, to signify that it's an implementation detail and should not be used publicly. 2. Create new classes `torch::nn::ConvOptions<N>` and `torch::nn::ConvTransposeOptions<N>`, which have parameters that exactly match the constructor of `torch.nn.Conv{1,2,3}d` and `torch.nn.ConvTranspose{1,2,3}d` in Python API. Pull Request resolved: pytorch#31005 Differential Revision: D18898048 Pulled By: yf225 fbshipit-source-id: 7663d646304c8cb004ca7f4aa4e70d3612c7bc75
…ow to use them in a Sequential module (pytorch#32223) Summary: Following changes in pytorch#31005. Pull Request resolved: pytorch#32223 Differential Revision: D19415328 Pulled By: yf225 fbshipit-source-id: f6f74f10ba3b5cc7e1a92f8b02ea4c9747018ae8
…ow to use them in a Sequential module (pytorch#32223) Summary: Following changes in pytorch#31005. Pull Request resolved: pytorch#32223 Differential Revision: D19415328 Pulled By: yf225 fbshipit-source-id: f6f74f10ba3b5cc7e1a92f8b02ea4c9747018ae8
Currently, both
Conv{1,2,3}dOptionsandConvTranspose{1,2,3}dOptionsare aliases of theConvOptions<{1,2,3}>class, which causes confusion because theConvOptionsclass has parameters such astransposedthat shouldn't be exposed to the end user. (This has caused issues such as #30931.) This PR makes the following improvements:torch::nn::ConvOptions<N>class totorch::nn::detail::ConvNdOptions<N>class, to signify that it's an implementation detail and should not be used publicly.torch::nn::ConvOptions<N>andtorch::nn::ConvTransposeOptions<N>, which have parameters that exactly match the constructor oftorch.nn.Conv{1,2,3}dandtorch.nn.ConvTranspose{1,2,3}din Python API.This PR is BC-breaking in the following way:
Conv{1,2,3}dOptionsno longer has thetransposedargument. Users should migrate their code to useConvTranspose{1,2,3}dlayers instead, if they havetransposedoriginally set totrueinConv{1,2,3}dOptions. Note thatConvTranspose{1,2,3}dcannot be used in aSequentialmodule becauseSequentialmodule doesn't support modules with forward method that can take optional arguments. Users should create their own wrapper forConvTranspose{1,2,3}dand have its forward method just accept a tensor, if they want to use it in aSequentialmodule.For example: