Skip to content

Conversation

@zou3519
Copy link
Contributor

@zou3519 zou3519 commented Jan 25, 2018

Fixes #4835

There's a bug in THCDeviceTensor::downcastOuter where it sometimes doesn't recognize a contiguous tensor as being contiguous. For example,

x = Variable(torch.randn(7, 1, 5, 3, 2).cuda())
strange_strides = [30, 1234, 6, 2, 1]
y = x.as_strided(x.size(), strange_strides)
y.strides()  # [30, 1234, 6, 2, 1]

y has valid strides and is contiguous because we don't care about what the stride value is at dimensions that has size 1. This changes downcastOuter to take that into account, fixing behavior for VolumetricAveragePooling, VolumetricMaxUnpooling, and VolumetricDilatedMaxPooling and other things that depend on these.

Test Plan

New unit test for this behavior.
A lot of the Pooling layers also use downcastOuter so run test_nn.

@zou3519
Copy link
Contributor Author

zou3519 commented Jan 25, 2018

@pytorchbot retest this please

1 similar comment
@zou3519
Copy link
Contributor Author

zou3519 commented Jan 26, 2018

@pytorchbot retest this please

@zou3519
Copy link
Contributor Author

zou3519 commented Jan 29, 2018

@pytorchbot retest this please

@ssnl
Copy link
Collaborator

ssnl commented Feb 1, 2018

Discussed offline. Let's remove downcastOuter/Inner and isContiguousRange, move isContiguousRange code to isContiguous (with proper changes), and use the new newView functionality from #4062 .

@zou3519
Copy link
Contributor Author

zou3519 commented Feb 5, 2018

Closing this in favor of #5052, which replaces usages of downcastOuter with newView.

@zou3519 zou3519 closed this Feb 5, 2018
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.

MaxPool3d raises 'RuntimeError: Can only downcast contiguous tensors' After deconvolution and permute(.contiguous() applied)

2 participants