repeat(*sizes) → Tensor Repeats this tensor along the specified dimensions. Unlike expand(), this function copies the tensor’s data. WARNING torch.repeat() behaves differently from numpy.repeat, but is more similar to numpy.tile. For the operator sim…
Numpy的tile(A, reps)函数,就是将原矩阵横向.纵向地复制.tile是瓷砖的意思,顾名思义,这个函数就是把数组像瓷砖一样铺展开来. 举个例子,原矩阵: 横向铺展: 纵向铺展: 横向铺展+纵向铺展: 最后再让我们来看看源码是怎么解释的: Construct an array by repeating A the number of times given by reps. 顾名思义就是通过重复/循环 A reps次来构建一个数组.…