In [1]:
import numpy as np
In [2]:
a_2d = np.arange(6).reshape(2, 3)
print(a_2d)
In [3]:
a_2d_fliplr = np.fliplr(a_2d)
print(a_2d_fliplr)
In [4]:
print(np.shares_memory(a_2d, a_2d_fliplr))
In [5]:
print(a_2d[:, ::-1])
In [6]:
a_1d = np.arange(3)
print(a_1d)
In [7]:
# print(np.fliplr(a_1d))
# ValueError: Input must be >= 2-d.
In [8]:
a_3d = np.arange(24).reshape(2, 3, 4)
print(a_3d)
In [9]:
print(np.fliplr(a_3d))
In [10]:
print(a_3d[:, ::-1])