Is there a way to replicate/repeat/loop the values of a tensor to any size? I know PyTorch has repeat() and expand(), which allows for repetition of a tensor, but they only works for sizes that are multiples of the original size and it may be computationally wasteful to create tensor of bigger size and then remove the extra values. My question is, there a way to create an periodic sawtooth/triangle waveform/periodic pattern with the core PyTorch package that given a tensor defining a period it will repeat the pattern to any dimension/shape?
If we have a tensor like this:
>>> a = th.arange(1, 3, 0.5) >>> a tensor([1.0000, 1.5000, 2.0000, 2.5000])
Can we get something like this:
>>> a.replicate(10) tensor([1.0000, 1.5000, 2.0000, 2.5000, 1.0000, 1.5000, 2.0000, 2.5000, 1.0000, 1.5000])