<p dir="auto">I found some error when running nn.MaxUnpool1d example in  <a href="https://pytorch.org/docs/stable/nn.html?highlight=maxunpool1d#torch.nn.MaxUnpool1d" rel="nofollow">doc</a>.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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())"><pre class="notranslate"><code class="notranslate">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())
</code></pre></div>
<p dir="auto">The output is shown below.<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/35796307/52639687-c3f2e080-2f0f-11e9-8f47-e1fdd3917217.jpg"><img src="https://user-images.githubusercontent.com/35796307/52639687-c3f2e080-2f0f-11e9-8f47-e1fdd3917217.jpg" alt="1" style="max-width: 100%;"></a></p>
<h2 dir="auto">🐛 Bug</h2>
<p dir="auto">I am getting a <code class="notranslate">TypeError: can only concatenate tuple (not "list") to tuple</code> when specifying the <code class="notranslate">output_shape</code> in <code class="notranslate">nn.MaxUnpool1d()</code></p>
<h2 dir="auto">To Reproduce</h2>
<p dir="auto">Steps to reproduce the behavior:</p>
<p dir="auto">Using the example on <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.MaxUnpool1d" rel="nofollow">https://pytorch.org/docs/stable/nn.html#torch.nn.MaxUnpool1d</a>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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())"><pre class="notranslate"><code class="notranslate">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())
</code></pre></div>
<h2 dir="auto">Stack Trace</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
&lt;ipython-input-13-ac9f59d350ad&gt; in &lt;module&gt;
      7 input = torch.tensor([[[1., 2, 3, 4, 5, 6, 7, 8, 9]]])
      8 output, indices = pool(input)
----&gt; 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:
--&gt; 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,
--&gt; 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)
--&gt; 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 &quot;list&quot;) to tuple"><pre class="notranslate"><code class="notranslate">---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
&lt;ipython-input-13-ac9f59d350ad&gt; in &lt;module&gt;
      7 input = torch.tensor([[[1., 2, 3, 4, 5, 6, 7, 8, 9]]])
      8 output, indices = pool(input)
----&gt; 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:
--&gt; 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,
--&gt; 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)
--&gt; 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
</code></pre></div>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">When I do not specify <code class="notranslate">output_shape</code> in <code class="notranslate">unpool</code>, everything is fine:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; tensor([[[0., 2., 0., 4., 0., 6., 0., 8.]]])"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; tensor([[[0., 2., 0., 4., 0., 6., 0., 8.]]])
</code></pre></div>

<h2 dir="auto">Environment</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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                    &lt;pip&gt;
[conda] torch                     0.4.1                     &lt;pip&gt;
[conda] torch                     1.0.0a0+1d11185           &lt;pip&gt;
[conda] torch                     1.0.0a0+e9db959           &lt;pip&gt;
[conda] torchtext                 0.3.1                     &lt;pip&gt;
[conda] torchvision               0.2.1                     &lt;pip&gt;"><pre class="notranslate"><code class="notranslate">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                    &lt;pip&gt;
[conda] torch                     0.4.1                     &lt;pip&gt;
[conda] torch                     1.0.0a0+1d11185           &lt;pip&gt;
[conda] torch                     1.0.0a0+e9db959           &lt;pip&gt;
[conda] torchtext                 0.3.1                     &lt;pip&gt;
[conda] torchvision               0.2.1                     &lt;pip&gt;
</code></pre></div>
<h2 dir="auto">Additional context</h2>
<p dir="auto">My use case is a fully convolutional network for 1D data, where I would like the model to learn the weights associated with unpooling.</p>
<p dir="auto">Edit: using the example from docs.</p>