mars.tensor.repeat#
- mars.tensor.repeat(a, repeats, axis=None)[来源]#
 重复张量的元素。
- Parameters
 - Returns
 repeated_tensor – 输出数组,其形状与 a 相同,除了在给定轴上。
- Return type
 张量
另请参阅
tile对张量进行切片。
示例
>>> import mars.tensor as mt
>>> mt.repeat(3, 4).execute() array([3, 3, 3, 3]) >>> x = mt.array([[1,2],[3,4]]) >>> mt.repeat(x, 2).execute() array([1, 1, 2, 2, 3, 3, 4, 4]) >>> mt.repeat(x, 3, axis=1).execute() array([[1, 1, 1, 2, 2, 2], [3, 3, 3, 4, 4, 4]]) >>> mt.repeat(x, [1, 2], axis=0).execute() array([[1, 2], [3, 4], [3, 4]])