In [1]:
import numpy as np

In [2]:
a = np.arange(3)
print(a)


[0 1 2]

In [3]:
a_tile = np.tile(a, 3)
print(a_tile)


[0 1 2 0 1 2 0 1 2]

In [4]:
print(a)


[0 1 2]

In [5]:
print(np.tile(a, (2, 3)))


[[0 1 2 0 1 2 0 1 2]
 [0 1 2 0 1 2 0 1 2]]

In [6]:
print(np.tile(a, (2, 3)).shape)


(2, 9)

In [7]:
print(np.tile(a, (2, 3, 4)))


[[[0 1 2 0 1 2 0 1 2 0 1 2]
  [0 1 2 0 1 2 0 1 2 0 1 2]
  [0 1 2 0 1 2 0 1 2 0 1 2]]

 [[0 1 2 0 1 2 0 1 2 0 1 2]
  [0 1 2 0 1 2 0 1 2 0 1 2]
  [0 1 2 0 1 2 0 1 2 0 1 2]]]

In [8]:
print(np.tile(a, (2, 3, 4)).shape)


(2, 3, 12)

In [9]:
a_2d = np.arange(6).reshape(2, 3)
print(a_2d)


[[0 1 2]
 [3 4 5]]

In [10]:
print(np.tile(a_2d, 2))


[[0 1 2 0 1 2]
 [3 4 5 3 4 5]]

In [11]:
print(np.tile(a_2d, (2, )))


[[0 1 2 0 1 2]
 [3 4 5 3 4 5]]

In [12]:
print(np.tile(a_2d, (1, 2)))


[[0 1 2 0 1 2]
 [3 4 5 3 4 5]]

In [13]:
print(np.tile(a_2d, (2, 1)))


[[0 1 2]
 [3 4 5]
 [0 1 2]
 [3 4 5]]

In [14]:
print(np.tile(a_2d, (2, 2, 2)))


[[[0 1 2 0 1 2]
  [3 4 5 3 4 5]
  [0 1 2 0 1 2]
  [3 4 5 3 4 5]]

 [[0 1 2 0 1 2]
  [3 4 5 3 4 5]
  [0 1 2 0 1 2]
  [3 4 5 3 4 5]]]

In [15]:
print(np.tile(a_2d, (2, 2, 2)).shape)


(2, 4, 6)