Extract elements from matrix given indices from max_pool2d

Probably this might help