Crop rectangular portions from a batch of tensors

Hi all,

Is there a function to crop rectangular boxes from a batch of tensors. More precisely, given a tensor of size BxMxN and a bounding box coordinate tensor of size Bx4 (the four values represent (x,y,x+w,y+h) where (x,y) is the top-left co-ordinate value), the task is to crop the corresponding rectangular portions from each of the MxN tensors. Can we do it in one step without using any loops?.


I don’t know of a way to do this, but here’s a link to someone trying to do exactly the same thing.
Good luck


Thank you! This really helped :slight_smile: