For 2d torch gather, specifying dim 0 means that for each entry along dim 0, indices are used to gather elements on dim 1. Say dim 0 is the batch dimension, the indices in this case will be used to gather along the features dimension.
For 3d torch gather, specifying dim 0 means that indices are directly applied to dim 0.
The 3d implementation actually generalizes to tensors of all dimensions. Why do we have the 2d gather special case?