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

Deprecate Conv2d, ConvTranspose2d and BatchNorm2d #2244

Merged
merged 2 commits into from
May 20, 2020

Conversation

fmassa
Copy link
Member

@fmassa fmassa commented May 20, 2020

PyTorch now natively supports empty batches for Conv2d, ConvTranspose2d and BatchNorm2d, so no need to have our own versions anymore.

Follow-up from #2215 which removed those ops. I'm adding the functions back to avoid breaking BC, but I'm raising a error instead to encourage users to replace those ops in their code.

@fmassa
Copy link
Member Author

fmassa commented May 20, 2020

@pmeier I've started seeing python_type_check errors recently, do you have an idea of what this might be?

@pmeier
Copy link
Collaborator

pmeier commented May 20, 2020

@pmeier I've started seeing python_type_check errors recently, do you have an idea of what this might be?

I'll investigate and get back to you.


The problem arises if version.py does not exist in torchvision/. It should be created while running setup.py. Since we install torchvision during the CI run

command: |
pip install --user --progress-bar off numpy mypy
pip install --user --progress-bar off --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
pip install --user --progress-bar off .
mypy --config-file mypy.ini

and the creation of the version.py file is unconditional

vision/setup.py

Lines 51 to 61 in cb65590

def write_version_file():
version_path = os.path.join(cwd, 'torchvision', 'version.py')
with open(version_path, 'w') as f:
f.write("__version__ = '{}'\n".format(version))
f.write("git_version = {}\n".format(repr(sha)))
f.write("from torchvision.extension import _check_cuda_version\n")
f.write("if _check_cuda_version() > 0:\n")
f.write(" cuda = _check_cuda_version()\n")
write_version_file()

I am a little puzzled about what is going on. Unfortunately, I don't have to capacity to debug the CI for now. Could you do that? I would start by checking if the file is created where it is supposed to be. Maybe cwd is incorrectly set in setup.py?

@fmassa fmassa merged commit 9055250 into pytorch:master May 20, 2020
@fmassa fmassa deleted the deprecate-some-misc-ops branch May 20, 2020 12:41
@fmassa
Copy link
Member Author

fmassa commented May 20, 2020

@pmeier we should note that the CI job for python_type_check doesn't compile nor install torchvision, so setup.py is not invoked, so this error is kind of expected I think, following your explanation.

What puzzles me is that this CI was working before and just recently stopped working, and I don't have any ideas why that would be the case.

@pmeier
Copy link
Collaborator

pmeier commented May 20, 2020

CI job for python_type_check doesn't compile nor install torchvision, so setup.py is not invoked,

Isn't L134 below doing exactly that?

command: |
pip install --user --progress-bar off numpy mypy
pip install --user --progress-bar off --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
pip install --user --progress-bar off .
mypy --config-file mypy.ini

@fmassa
Copy link
Member Author

fmassa commented May 20, 2020

Oh, you are right, I missed that line. Let me have a closer look at the commit history

@fmassa
Copy link
Member Author

fmassa commented May 20, 2020

Let's see if #2246 fixes it (I'm not sure)

fmassa added a commit to fmassa/vision-1 that referenced this pull request Jun 9, 2020
* Deprecate Conv2d, ConvTranspose2d and BatchNorm

* Fix lint
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.

2 participants