Issue 1:
I found some error when running nn.MaxUnpool1d example in doc.

import torch
import torch.nn as nn

pool = nn.MaxPool1d(2, stride=2, return_indices=True)
unpool = nn.MaxUnpool1d(2, stride=2)

# Example showcasing the use of output_size
input = torch.tensor([[[1., 2, 3, 4, 5, 6, 7, 8, 9]]])
output, indices = pool(input)
unpool(output, indices, output_size=input.size())

The output is shown below.

Issue 2:
🐛 Bug

I am getting a TypeError: can only concatenate tuple (not "list") to tuple when specifying the output_shape in nn.MaxUnpool1d()

To Reproduce

Steps to reproduce the behavior:

Using the example on https://pytorch.org/docs/stable/nn.html#torch.nn.MaxUnpool1d:

import torch.nn as nn

pool = nn.MaxPool1d(2, stride=2, return_indices=True)
unpool = nn.MaxUnpool1d(2, stride=2)

# Example showcasing the use of output_size
input = torch.tensor([[[1., 2, 3, 4, 5, 6, 7, 8, 9]]])
output, indices = pool(input)
unpool(output, indices, output_size=input.size())

Stack Trace

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-13-ac9f59d350ad> in <module>
7 input = torch.tensor([[[1., 2, 3, 4, 5, 6, 7, 8, 9]]])
8 output, indices = pool(input)
----> 9 unpool(output, indices, output_size=input.size())

~/src/checkout/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
487 result = self._slow_forward(*input, **kwargs)
488 else:
--> 489 result = self.forward(*input, **kwargs)
490 for hook in self._forward_hooks.values():
491 hook_result = hook(self, input, result)

~/src/checkout/miniconda3/lib/python3.7/site-packages/torch/nn/modules/pooling.py in forward(self, input, indices, output_size)
292 def forward(self, input, indices, output_size=None):
293 return F.max_unpool1d(input, indices, self.kernel_size, self.stride,
--> 294 self.padding, output_size)
295
296

~/src/checkout/miniconda3/lib/python3.7/site-packages/torch/nn/functional.py in max_unpool1d(input, indices, kernel_size, stride, padding, output_size)
512 output_size = _unpool_output_size(input, kernel_size, _stride, padding,
513 output_size)
--> 514 return torch._C._nn.max_unpool2d(input.unsqueeze(3), indices.unsqueeze(3), output_size + [1]).squeeze(3)
515
516

TypeError: can only concatenate tuple (not "list") to tuple

Expected behavior

When I do not specify output_shape in unpool, everything is fine:

>>> tensor([[[0., 2., 0., 4., 0., 6., 0., 8.]]])

Environment

PyTorch version: 1.0.0a0+e9db959
Is debug build: No
CUDA used to build PyTorch: None

OS: Mac OSX 10.14
GCC version: Could not collect
CMake version: version 3.12.2

Python version: 3.7
Is CUDA available: No
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA

Versions of relevant libraries:
[pip] Could not collect
[conda] blas 1.0 mkl
[conda] mkl 2019.1 144
[conda] mkl-include 2019.1 144
[conda] mkl_fft 1.0.6 py37h27c97d8_0
[conda] mkl_random 1.0.2 py37h27c97d8_0
[conda] pytorch-nightly 1.0.0.dev20181117 py3.7_0 pytorch
[conda] pytorch-sphinx-theme 0.0.19 <pip>
[conda] torch 0.4.1 <pip>
[conda] torch 1.0.0a0+1d11185 <pip>
[conda] torch 1.0.0a0+e9db959 <pip>
[conda] torchtext 0.3.1 <pip>
[conda] torchvision 0.2.1 <pip>

Additional context

My use case is a fully convolutional network for 1D data, where I would like the model to learn the weights associated with unpooling.

Edit: using the example from docs.