Hi,
I’m afraid there is not very elegant way to do this.
Another approach would be to convert your 2D indices into a 1D index into a dimension of size height * width.
Then you can use view of a and a single gather to get what you want.