python - How can I swap values in PyTorch Tensor? - Stack ...
https://stackoverflow.com/.../how-can-i-swap-values-in-pytorch-tensorI have the following tensor: vector = torch.tensor([[1,5,3], [2,3,4]]) How can I swap values in the second axis? e.g. tensor([[1, 5, 3], [2, 3, 4]]) becomes: tensor ...
numpy.swapaxes — NumPy v1.22 Manual
numpy.org › doc › stablenumpy.swapaxes. ¶. Interchange two axes of an array. Input array. First axis. Second axis. For NumPy >= 1.10.0, if a is an ndarray, then a view of a is returned; otherwise a new array is created. For earlier NumPy versions a view of a is returned only if the order of the axes is changed, otherwise the input array is returned.
torch.swapaxes — PyTorch 1.10.1 documentation
pytorch.org › docs › stableLearn about PyTorch’s features and capabilities. Community. Join the PyTorch developer community to contribute, learn, and get your questions answered. Developer Resources. Find resources and get questions answered. Forums. A place to discuss PyTorch code, issues, install, research. Models (Beta) Discover, publish, and reuse pre-trained models