torch.tensor.repeat(*sizes)
- 官方解释:Repeats this tensor along the specified dimensions.
- 参数说明:
- sizes (torch.Size or int…) – The number of times to repeat this tensor along each dimension.
- 个人理解
Y = X.repeat([4])
Y = X.repeat([3,4])
Y = X.repeat([2,3,4])
Y = X.repeat([1,2,3,4])
Y = X.repeat([3,4])
Y = X.repeat([2,3,4])
Y = X.repeat([1,2,3,4])
torch.repeat_interleave(input, repeats, dim=None, *, output_size=None)
- 官方解释:Repeat elements of a tensor.
- 参数说明:
- input (Tensor) – the input tensor.
- repeats (Tensor or int) – The number of repetitions for each element. repeats is broadcasted to fit the shape of the given axis.
- dim (int, optional) – The dimension along which to repeat values. By default, use the flattened input array, and return a flat output array.
- output_size (int, optional) – Total output size for the given axis ( e.g. sum of repeats). If given, it will avoid stream syncronization needed to calculate output shape of the tensor.
- 个人理解
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)