numpy.tile的作用
import numpy as np
# 重复一个标量值
scalar = 5
result1 = np.tile(scalar, 3)
print(result1) # 输出:[5, 5, 5]
# 重复一个数组
arr = [1, 2, 3]
result2 = np.tile(arr, 2)
print(result2) # 输出:[1, 2, 3, 1, 2, 3]
# 在两个维度上进行不同次数的重复
arr = [[1, 2], [3, 4]]
result3 = np.tile(arr, (2, 3))
print(result3)
# 输出:
# [[1 2 1 2 1 2]
# [3 4 3 4 3 4]
# [1 2 1 2 1 2]
# [3 4 3 4 3 4]]
标签:arr,python,print,笔记,tile,scalar,杂乱,np,numpy
From: https://www.cnblogs.com/code-pigeon/p/17783463.html