Documentation: https://shift-nth-row-n-steps.readthedocs.io
Source Code: https://github.com/34j/shift-nth-row-n-steps
Shift Nth row N steps in NumPy / PyTorch / TensorFlow / JAX
Install this via pip (or your favourite package manager):
pip install shift-nth-row-n-steps
from shift_nth_row_n_steps import shift_nth_row_n_steps
a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
shifted = shift_nth_row_n_steps(a)
print(shifted)
[[1 2 3]
[0 4 5]
[0 0 7]]
shift_nth_row_n_steps
is array API compatible, which means it works with NumPy, PyTorch, JAX, and other libraries that implement the array API standard.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
This package was created with Copier and the browniebroke/pypackage-template project template.