pytorch / pytorch

Tensors and Dynamic neural networks in Python with strong GPU acceleration
https://pytorch.org
Other
82.23k stars 22.12k forks source link

Reversing along a dimension, similarly to numpy #95160

Open dennisushi opened 1 year ago

dennisushi commented 1 year ago

🚀 The feature, motivation and pitch

In numpy you can reverse an array as arr[::-1] along any dimension. The same in torch raises an error: ValueError: step must be greater than zero. It would be useful if both operated the same way.

Alternatives

No response

Additional context

No response

cc @mruberry @rgommers

dennisushi commented 1 month ago

I can confirm that this is still not supported