-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Add Conv2dNormActivation and Conv3dNormActivation Blocks #5445
Conversation
💊 CI failures summary and remediationsAs of commit 7a6100c (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages: binary_win_wheel_py3.10_cu115 (1/1)Step: "Checkout code" (full log | diagnosis details | 🔁 rerun)
|
Job | Step | Action |
---|---|---|
cmake_macos_cpu | curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh | |
sh conda.sh -b | ||
source $HOME/miniconda3/bin/activate | ||
conda install -yq conda-build cmake | ||
packaging/build_cmake.sh | ||
🔁 rerun |
This comment was automatically generated by Dr. CI (expand for details).
Please report bugs/suggestions to the (internal) Dr. CI Users group.
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.
@oke-aditya I've added a few suggestions that aim to simplify the code duplication. Let me know what you think.
All of the proposals assume we will deprecate the old class. There is an alterantive but let's discuss it here after we clean up this proposal.
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.
Last couple of nits:
@jdsgomes @oke-aditya The current proposal looks good to me. There is one more pending required here which is to replace all existing Finally, I have a question for your consideration. The There is an alternative approach that would require minor adaptation of your solution that can allow you to avoid the deprecation. On your current PR, you have the option to rename. No solution is perfect, each has pros/cons. What you will choose should depend on what you optimize for and how many users you will affect. At any case, please document the reasons here so that it's transparent why we do what we do. 😃 |
I agree with the comments from @datumbox. I suggested otherwise initially , but the fact is that there are already 39 occurrences of So @oke-aditya agrees, I would suggest to make the changes proposed by @datumbox and we can get it merged! |
@oke-aditya raised a good point offline related to this changes. This was recently exposed in ops/init.py and we will be reverting this on a separate PR in the spirit not promoting the usage of So I think I can work on this separately and create a PR that will
|
So in a brief offline discussion with @jdsgomes We are exposing Also, fully agreeing that PyTorch is highly stable and we need to keep our codebase backward compatible and avoid such sudden changes. (Having the power to deprecate doesn't mean we should keep using it often 😄 ) I will refactor the implementation to be compatible with the old one as @datumbox suggested. |
� Conflicts: � docs/source/ops.rst � torchvision/ops/__init__.py
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.
LGTM, thank you for working on this @oke-aditya !
torchvision/ops/misc.py
Outdated
if activation_layer is not None: | ||
params = {} if inplace is None else {"inplace": inplace} | ||
layers.append(activation_layer(**params)) | ||
super().__init__(*layers) | ||
_log_api_usage_once(self) | ||
self.out_channels = out_channels | ||
|
||
if self.__class__ == ConvNormActivation: | ||
warnings.warn("Don't use ConvNormActivation directly. Use Conv2dNormActivation instead.") |
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.
warnings.warn("Don't use ConvNormActivation directly. Use Conv2dNormActivation instead.") | |
warnings.warn("Don't use ConvNormActivation directly, please use Conv2dNormActivation and Conv3dNormActivation instead.") |
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.
@oke-aditya Looks good!
The work on the block itself is complete but now we need to replace all the usages of ConvNormActivation
from the code-base with Conv2dNormActivation
. This update needs to happen on this PR to avoid generating unwanted warnings to our users.
Yes I'm on it!! |
Please compare 9a5ab98 I think I have replaced all the places! |
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.
LGTM, thanks @oke-aditya!
@jdsgomes What you thing of cherrypicking this on the release so that we don't advertise using ConvNormActication on the mobilenets? Did the final RC was produced by the release engineering team?
After discussing offline with @datumbox we decided not to cherrypick this one as we missed the official cut off date and this is quite a bit change. |
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.
LGTM!
) Summary: * Add ops.conv3d * Refactor for conv2d and 3d * Refactor * Fix bug * Addres review * Fix bug * nit fix * Fix flake * Final fix * remove documentation * fix linter * Update all the implementations to use new Conv * Small doc fix Reviewed By: jdsgomes Differential Revision: D34475305 fbshipit-source-id: 281f0a547574636e69396e707dad422969ccf380 Co-authored-by: Vasilis Vryniotis <[email protected]> Co-authored-by: Joao Gomes <[email protected]>
Closes #5430
Simple code to try this. It worked fine.