Use np.repeat() :
In [9]: A = np.array([[1, 2, 3, 4]]) In [10]: np.repeat(np.repeat(A, 2).reshape(2, 4), 2, 0) Out[10]: array([[1, 1, 2, 2], [1, 1, 2, 2], [3, 3, 4, 4], [3, 3, 4, 4]])
Explanation:
First you can repeat the arrya elements:
In [30]: np.repeat(A, 3) Out[30]: array([1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4])
then you need to change the form of the result (depending on your expected result, this may be different):
In [32]: np.repeat(A, 3).reshape(2, 3*2) array([[1, 1, 1, 2, 2, 2], [3, 3, 3, 4, 4, 4]])
And now you should repeat the result along the first axis:
In [34]: np.repeat(np.repeat(A, 3).reshape(2, 3*2), 3, 0) Out[34]: array([[1, 1, 1, 2, 2, 2], [1, 1, 1, 2, 2, 2], [1, 1, 1, 2, 2, 2], [3, 3, 3, 4, 4, 4], [3, 3, 3, 4, 4, 4], [3, 3, 3, 4, 4, 4]])