Implements volumetric (5d) affine grid generation.#8322
Implements volumetric (5d) affine grid generation.#8322elistevens wants to merge 14 commits intopytorch:masterfrom
Conversation
torch/nn/_functions/vision.py
Outdated
|
|
||
| base_grid[:, :, :, :, 0] = w_points | ||
| base_grid[:, :, :, :, 1] = h_points | ||
| base_grid[:, :, :, :, 2] = d_points |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
| base_grid[:, :, :, 1] = torch.ger(linear_points, torch.ones(W)).expand_as(base_grid[:, :, :, 1]) | ||
| base_grid[:, :, :, 2] = 1 | ||
| ctx.base_grid = base_grid | ||
| grid = torch.bmm(base_grid.view(N, H * W, 3), theta.transpose(1, 2)) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/nn/_functions/vision.py
Outdated
| if theta.is_cuda: | ||
| AffineGridGenerator._enforce_cudnn(theta) | ||
| assert False | ||
| ctx.is_cuda = False |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
ssnl
left a comment
There was a problem hiding this comment.
Can you add tests for this too? And FYI this function should be eventually move to ATen c++ side one day, and the cudnn check logic will be a lot simpler when that happens.
| if grad_grid.is_cuda: | ||
| AffineGridGenerator._enforce_cudnn(grad_grid) | ||
| if len(ctx.size) == 5: | ||
| N, C, D, H, W = ctx.size |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
@elistevens Let us know if you have time to address @ssnl 's comments |
|
Sorry for the slow response. I've been traveling and will be for another
week still, but I intend to work on this when I get back.
…On Tue, Jul 10, 2018, 09:50 Will Feng ***@***.***> wrote:
@elistevens <https://github.com/elistevens> Let us know if you have time
to address @ssnl <https://github.com/SsnL> 's comments
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8322 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAIbIM1f9phgRQPh8qwHNDt2wMWsgDi6ks5uFNs4gaJpZM4Uh4b5>
.
|
|
@ssnl @yf225 I've added tests and cleaned up the implementation. Note that I've removed all of the "if Are there any other changes desired? |
|
The jenkins builds are failing, though the tests work locally. There are going to be some extra pushes while I try and figure out what the difference is between my local setup and the formal testing. Sorry for the noise. |
|
@soumith Yes, absolutely. This was intended to be a temporary measure to get around the older version issue. I'll revert it once the docker images are updated. :) |
|
@elistevens I just updated the scipy version in our docker images to 1.1.0. Do you mind reverting the change to requirements.txt and see if CI passes? |
|
Will do tonight. Thanks!
…On Mon, Jul 23, 2018, 12:16 Will Feng ***@***.***> wrote:
@elistevens <https://github.com/elistevens> I just updated the scipy
version in our docker images to 1.1.0. Do you mind reverting the change to
requirements.txt and see if CI passes?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8322 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAIbIMTkQVNulr40F5hSHuhxYXRYCk9Cks5uJiEKgaJpZM4Uh4b5>
.
|
|
In case anyone is wondering about the https://ci.pytorch.org/jenkins/job/pytorch-builds/job/pytorch-linux-trusty-pynightly-test/11964/console doesn't have scipy installed. This doesn't seem to be related to my branch. Will this test failing be a merge blocker? I think the rest of the issues are due to integer division under python 2. Testing now. |
|
The last build had a handful of errors that all seemed unrelated to my changes (missing scipy on some of the testing images, windows build error, etc.). @ssnl Are there any other desired changes? |
|
@pytorchbot retest this please |
|
@yf225 the remaining three failures are all due to scipy being missing entirely from the relevant images. Is that something you care to fix? |
|
@elistevens We should probably use the |
|
What's the project policy on PRs with failing tests that are unrelated to the PR? Do I need all green before a merge will be considered? I'm not sure if I should be merging master and hoping the issues get resolved, or if review of the failures is sufficient. |
test/test_affine.py
Outdated
| @@ -0,0 +1,602 @@ | |||
| from __future__ import print_function, division | |||
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
@elistevens after Simon's comment is addressed, this PR is good to go, i.e.:
|
| @@ -1,345 +1,345 @@ | |||
| #!/usr/bin/env python | |||
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Keeps the 'affine' line removal, since that's still needed.
test/test_nn.py
Outdated
| return transform_tensor, transform_ary, grid_ary | ||
|
|
||
|
|
||
| class TestAffine(TestCase): |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
facebook-github-bot
left a comment
There was a problem hiding this comment.
SsnL has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: I've implemented affine grid generation for volumetric (5d) inputs. The implementation is based off of the spatial implementation, extended by one dimension. I have a few questions about my implementation vs. the existing one that I will add inline. I have some extensive test cases for the forward pass here: https://gist.github.com/elistevens/6e3bfb20d8d0652b83bd16b3e911285b However, they use `pytest.fixture` extensively, so I'm not sure the best way to incorporate them into the pytorch test suite. Suggestions? I have not tested backwards at all. Diff probably best viewed with whitespace changes ignored. Thanks for considering! Pull Request resolved: pytorch#8322 Differential Revision: D9332335 Pulled By: SsnL fbshipit-source-id: 1b3a91d078ef41a6d0a800514e49298fd817e4df
Summary: I've implemented affine grid generation for volumetric (5d) inputs. The implementation is based off of the spatial implementation, extended by one dimension. I have a few questions about my implementation vs. the existing one that I will add inline. I have some extensive test cases for the forward pass here: https://gist.github.com/elistevens/6e3bfb20d8d0652b83bd16b3e911285b However, they use `pytest.fixture` extensively, so I'm not sure the best way to incorporate them into the pytorch test suite. Suggestions? I have not tested backwards at all. Diff probably best viewed with whitespace changes ignored. Thanks for considering! Pull Request resolved: pytorch#8322 Differential Revision: D9332335 Pulled By: SsnL fbshipit-source-id: 1b3a91d078ef41a6d0a800514e49298fd817e4df
Summary: Pull Request resolved: #10775 Differential Revision: D9458207 Pulled By: SsnL fbshipit-source-id: f2b0dbf2d236134afded9b15d8bf55ff98f50e7b
Summary: Pull Request resolved: pytorch#10775 Differential Revision: D9458207 Pulled By: SsnL fbshipit-source-id: f2b0dbf2d236134afded9b15d8bf55ff98f50e7b
I've implemented affine grid generation for volumetric (5d) inputs. The implementation is based off of the spatial implementation, extended by one dimension. I have a few questions about my implementation vs. the existing one that I will add inline.
I have some extensive test cases for the forward pass here: https://gist.github.com/elistevens/6e3bfb20d8d0652b83bd16b3e911285b However, they use
pytest.fixtureextensively, so I'm not sure the best way to incorporate them into the pytorch test suite. Suggestions? I have not tested backwards at all.Diff probably best viewed with whitespace changes ignored.
Thanks for considering!