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

Inconsistence in SpatialMaxPooling and SpatialMaxUnpooling operations for torch.CudaTensor that leads to an error #1287

Open
borismu opened this issue Oct 10, 2017 · 0 comments

Comments

@borismu
Copy link

borismu commented Oct 10, 2017

Using 'torch.FloatTensor' as dtype in following code snippet works just fine. Pool layer produces indices array of consistent size (1x5x5) with the input of unpooling layer.

dtype = 'torch.FloatTensor'
model = nn.Sequential()
layer = nn.SpatialMaxPooling(2,2,2,2)
model:add(layer)
model:add(nn.SpatialMaxUnpooling(layer))
model:type(dtype)

x = torch.randn(1,10,10):type(dtype)
model:forward(x)

However using 'torch.CudaTensor' produces error on executing model:forward(x).

dtype = 'torch.CudaTensor'
model = nn.Sequential()
layer = nn.SpatialMaxPooling(2,2,2,2)
model:add(layer)
model:add(nn.SpatialMaxUnpooling(layer))
model:type(dtype)

x = torch.randn(1,10,10):type(dtype)
model:forward(x)

Pooling layer instead produces indices of size 1x1x5x5 which is inconsistent with input of unpooling layer. That leads to following error.
torch/install/share/lua/5.1/nn/THNN.lua:110: indices and input shapes do not match: indices [1 x 1 x 5 x 5], input [1 x 5 x 5] at /tmp/luarocks_cunn-scm-1-3042/cunn/lib/THCUNN/generic/SpatialMaxUnpooling.cu:15

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

No branches or pull requests

1 participant