Replicate subtensors of tensors

Hello,

I have a tensor “image_features” having shape torch.Size([100, 1024, 14, 14]). I need to replicate each subtensor (1024, 14, 14) 10 times, obtaining a tensor having shape torch.Size([1000, 1024, 14, 14]). Basically, the first ten rows of the resulting tensor should correspond to the first row of the original one, the following ten rows of the resulting tensor should correspond to the second row of the original one, and so on. If possible, I don’t want to create a copy (each replicated subtensor can share memory with the tensor it is replicated from), but it is ok to create a copy if there isn’t any other way. How can I do it?

Thank you very much.