Thanks to visit codestin.com
Credit goes to github.com

Skip to content

No Default argument to max_unpool functions (Fixes #7327)#7388

Merged
zou3519 merged 2 commits into
masterfrom
unknown repository
May 29, 2018
Merged

No Default argument to max_unpool functions (Fixes #7327)#7388
zou3519 merged 2 commits into
masterfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented May 8, 2018

Functions max_unpool1d, max_unpool2d, max_unpool3d break for stride=None.
Fixed so as to default it to kernel_size.

@ghost ghost requested review from apaszke, colesbury, ezyang, gchanan, soumith and zdevito as code owners May 8, 2018 20:00
@ghost ghost changed the title Fix for Issue #7327 No Default argument to max_unpool functions (Fixes #7327) May 8, 2018
@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented May 8, 2018

Thanks. Can we have a test for this case?

@ghost
Copy link
Copy Markdown
Author

ghost commented May 9, 2018

import torch
from torch.nn import functional as F
input = torch.tensor([[[1., 2, 3, 4, 5, 6, 7, 8]]])
output, indices = F.max_pool1d(input, 2, stride=2, return_indices=True)
F.max_unpool1d(output, indices, 2, stride=2) # Output: tensor([[[ 0.,  2.,  0.,  4.,  0.,  6.,  0.,  8.]]])
F.max_unpool1d(output, indices, 2) # Fails before this PR

stride = None is passed to '_unpool_output_size' in '~/torch/nn/functional.py'

@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented May 13, 2018

Hi @vedaanta, your proposed test looks good. Can you add it to test_nn.py?

@zou3519 zou3519 merged commit 215fe05 into pytorch:master May 29, 2018
weiyangfb pushed a commit to weiyangfb/pytorch that referenced this pull request Jun 11, 2018
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
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.

3 participants