How to optimize useless tensors in memory

During the process of using tensor, I find that I seem to waste too much memory. A large number of reshapes and numpy to tensor, and tensor to numpy without clearing the memory seem to be a burden to my program. How can I clean up these useless tensors? Just set them to none?