How to crop image tensor in model

I found another solution from STN: using affine transform to do cropping. See discussion here Cropping a minibatch of images, each image a bit differently - #2 by smth