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

Add backend checks for batch norm #15955

Closed

Conversation

vishwakftw
Copy link
Contributor

@vishwakftw vishwakftw commented Jan 11, 2019

Fixes #15826

Changelog:

  • Add backend checks in batch_norm_cpu and batch_norm_cuda
  • Modify check in checkBackend to pass on undefined tensors.

cc: @soumith

@soumith
Copy link
Member

soumith commented Jan 11, 2019

i think legit test failures:

Jan 11 04:18:28 ======================================================================
Jan 11 04:18:28 ERROR: test_batchnorm_simple_average (__main__.TestNN)
Jan 11 04:18:28 ----------------------------------------------------------------------
Jan 11 04:18:28 Traceback (most recent call last):
Jan 11 04:18:28   File "test_nn.py", line 3002, in test_batchnorm_simple_average
Jan 11 04:18:28     self._test_batchnorm_simple_average()
Jan 11 04:18:28   File "test_nn.py", line 5529, in _test_batchnorm_simple_average
Jan 11 04:18:28     res1 = module(data1)
Jan 11 04:18:28   File "/opt/python/3.5/lib/python3.5/site-packages/torch/nn/modules/module.py", line 489, in __call__
Jan 11 04:18:28     result = self.forward(*input, **kwargs)
Jan 11 04:18:28   File "/opt/python/3.5/lib/python3.5/site-packages/torch/nn/modules/batchnorm.py", line 76, in forward
Jan 11 04:18:28     exponential_average_factor, self.eps)
Jan 11 04:18:28   File "/opt/python/3.5/lib/python3.5/site-packages/torch/nn/functional.py", line 1622, in batch_norm
Jan 11 04:18:28     training, momentum, eps, torch.backends.cudnn.enabled
Jan 11 04:18:28 RuntimeError: Tensor for argument #1 'input' is on CPU, Tensor for argument #2 'weight' is on CPU, but expected them to be on GPU (while checking arguments for batch_norm_cpu)

@vishwakftw
Copy link
Contributor Author

I know exactly what’s wrong, my bad. Will push a commit with the fix ASAP.

@vishwakftw vishwakftw force-pushed the batch-norm-backend-check branch 2 times, most recently from 42ded7e to 13b9e04 Compare January 11, 2019 06:20
@vishwakftw
Copy link
Contributor Author

@soumith The tests have been fixed.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@soumith is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

facebook-github-bot pushed a commit that referenced this pull request Jan 11, 2019
Summary:
Fixes #15826

Changelog:
- Add backend checks in `batch_norm_cpu` and `batch_norm_cuda`
- Modify check in `checkBackend` to pass on undefined tensors.

Differential Revision: D13636410

Pulled By: soumith

fbshipit-source-id: 3b1cfe5ca8b7c0346569077163503065e75c2659
@vishwakftw vishwakftw closed this Jan 12, 2019
@vishwakftw vishwakftw deleted the batch-norm-backend-check branch January 18, 2019 17:06
vishwakftw added a commit to vishwakftw/pytorch that referenced this pull request Jan 18, 2019
Summary:
Fixes pytorch#15826

Changelog:
- Add backend checks in `batch_norm_cpu` and `batch_norm_cuda`
- Modify check in `checkBackend` to pass on undefined tensors.

Differential Revision: D13636410

Pulled By: soumith

fbshipit-source-id: 3b1cfe5ca8b7c0346569077163503065e75c2659
soumith pushed a commit that referenced this pull request Jan 18, 2019
Summary:
Fixes #15826

Changelog:
- Add backend checks in `batch_norm_cpu` and `batch_norm_cuda`
- Modify check in `checkBackend` to pass on undefined tensors.

Differential Revision: D13636410

Pulled By: soumith

fbshipit-source-id: 3b1cfe5ca8b7c0346569077163503065e75c2659
soumith pushed a commit that referenced this pull request Jan 29, 2019
Summary:
Fixes #15826

Changelog:
- Add backend checks in `batch_norm_cpu` and `batch_norm_cuda`
- Modify check in `checkBackend` to pass on undefined tensors.

Differential Revision: D13636410

Pulled By: soumith

fbshipit-source-id: 3b1cfe5ca8b7c0346569077163503065e75c2659
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

torch.nn.BatchNorm1d Segmentation Fault with mixed CPU/GPU
4 participants