np.tile(A,res)函数,A 是个数组,reps 是个元组;tile这个函数把数组 A 当成一个元素来构造 shape 为 res 的数组adarray
import numpy as np
a = np.array([0,1,2,3])
np.tile(a, 2)
#Out
[0, 1, 2, 3, 0, 1, 2, 3]
import numpy as np
a = np.array([0,1,2,3])
np.tile(a, (2,2))
#Out
[ [0, 1, 2, 3, 0, 1, 2, 3] ,
[0, 1, 2, 3, 0, 1, 2, 3] ] )
import numpy as np
a = np.array([0,1,2,3])
np.tile(a, (2,1,2))
#OUt
[ [ [0, 1, 2, 3, 0, 1, 2, 3] ] ,
[ [0, 1, 2, 3, 0, 1, 2, 3] ] ] )