Is it possible to make indexing back-propagatable with respect to indices?

Hi,

I have a image im, and need to crop it to a bounding box (x1, x2, y1, y2). Currently I am doing im[y1: y2, x1: x2], but pytorch reminds me that indices should be integers or None. Is it possible to make the operation back-propagatable with respect to x1, x2, y1, y2?

You need something like spatial transformer networks.

My requirement is a little different from your paper. Rather than learning to focus to and transform specific region of an image, I would like to deterministically crop a given region.

Thanks anyway!

indexing is not differentiable wrt the indices. you will need to use a non-differentiable optimization method, probably reinforcement learning.