How to use MaxUnpool2d without indices?

Hi there,

I was trying to do an un-pooling operation on a feature map that was NOT produced by an pooling layer (say it might be a shrunken map after a ‘VALID’ convolution layer), thus I cannot pass the indices argument (which in normal is one of the outputs of pooling layer if you set return_indices option to True) to a MaxUnpool2d layer. The thing I want to do is simple, un-pool the value to one of the corners of a 2x2 kernel (top left, top right, bottom left or bottom right).

The solutions I could dope out are

  1. construct a fake indice tensor specifying the where values (in the input map) should go in the output (unpooled) map and pass it to a MaxUnpool2d layer,
  2. write a custom unpool layer that does not ask for a indices argument (the implementation might be similar as 1))

My question is, in the solutions above, which one is more common? Is there any other fancy ways to do such a operation?


generating the indices Tensor to your convenience (i.e. solution 1) seems like the easier path forward.

1 Like

OK, I’ll give it a try.

So many thanks.