Yes, you can do: a.gather(1, b.view(k, 1, 1).expand(k, 1, n)) will give you what you want 
Basically, use the gather function, and since you want all the elements over the last dimension of size n, you just expand the Tensor of indices there.