How to flip a tensor along a specified axis

When using biRNN I need to flip a input tensor along depth axis, but the function torch.index_select seems to block the flow of training gradients. So is there any reasonable way to do this operation correctly ?
Any advice would be appreciated !!!

IndexSelect should not block gradients (see https://github.com/pytorch/pytorch/blob/master/torch/autograd/_functions/tensor.py#L301). :slight_smile: