Use AdaptiveMaxPool indices for training

Hi,

I would like to know if it is possible to use Indices returned by AdaptiveMaxPool to feed into FC layers (not for Unpool) ?

The idea is to provide to the network what features is present, but also where is it. That may help for Embedding or Metric learning ?

Is this a crazy idea ?

I don’t think any idea is too crazy to run some experiments. :wink:
Note that the returned indices from this pooling layer are “detached”, i.e. they do not have a grad_fn and thus Autograd won’t backpropagate through them, so you should keep this information in mind when experimenting with it.

That what I am afraid of: the indice returned do not have grad_fn
Does this mean that backward will have some weird effect ? Would there be any trick to have the indices “attached” ?

Not directly, since you won’t be able to calculate gradients for these indices (unless you can come up with a valid backward method to do so and would implement it manually). Autograd will properly backpropagate to the max. values, but not the indices.