In [1]:
import numpy as np
In [2]:
a_2d = np.arange(6).reshape(2, 3)
print(a_2d)
In [3]:
a_2d_flip = np.flip(a_2d)
print(a_2d_flip)
In [4]:
print(np.shares_memory(a_2d, a_2d_flip))
In [5]:
print(a_2d[::-1, ::-1])
In [6]:
a_1d = np.arange(3)
print(a_1d)
In [7]:
print(np.flip(a_1d))
In [8]:
print(a_1d[::-1])
In [9]:
a_3d = np.arange(24).reshape(2, 3, 4)
print(a_3d)
In [10]:
print(np.flip(a_3d))
In [11]:
print(a_3d[::-1, ::-1, ::-1])
In [12]:
print(np.flip(a_3d, 0))
In [13]:
print(a_3d[::-1])
In [14]:
print(np.flipud(a_3d))
In [15]:
print(np.flip(a_3d, 1))
In [16]:
print(a_3d[:, ::-1])
In [17]:
print(np.fliplr(a_3d))
In [18]:
print(np.flip(a_3d, 2))
In [19]:
print(a_3d[:, :, ::-1])
In [20]:
print(np.flip(a_3d, (0, 1)))
In [21]:
print(a_3d[::-1, ::-1])
In [22]:
print(np.flip(a_3d, (1, 2)))
In [23]:
print(a_3d[:, ::-1, ::-1])
In [24]:
print(np.flip(a_3d, (0, 2)))
In [25]:
print(a_3d[::-1, :, ::-1])