How to tile a tensor without occupying new GPU memory

If the size of tensor is wery large, such as 40000*64. I want to tile the 0 dim with 100 times, if I use repeat, the menory of GPU will grow a lot. How can I do it without occupying new GPU memory, just use expand?

import torch

The the memory will up to 1500M, it is to higher!

1 Like