I have a tensor representign an image, and I want to cut a subimage out. I have a tensor representingn the topleft annd bottomright corner of the cut. I try:
view = image[subimage_min: subimage_max - subimage_min]
ie, in reproducible copy/paste code:
import torch
image = torch.rand(10, 10, 3)
subimage_min = torch.LongTensor([2, 3])
subimage_max = torch.LongTensor([5, 7])
view = image[subimage_min: subimage_max - subimage_min]
… but this gives ‘slice indices must be integers or None or have an index method’
Thoughts?