##这个功能比较简单,直接上代码
>>>np.repeat(3, 4)
array([3, 3, 3, 3])
>>>x = np.array([[1, 2],[3, 4]])
>>>np.repeat(x, 2)
array([1, 1, 2, 2, 3, 3, 4, 4])
>>>np.repeat(x, 2, axis=1)
array([[1, 1, 2, 2],
[3, 3, 4, 4]])
>>>np.repeat(x, 2, axis=0)
array([[1, 2],
[1, 2],
[3, 4],
[3, 4]])
来源.
1066

被折叠的 条评论
为什么被折叠?



