[tensorexpr] Add memory planning to reuse intermediate buffers (#66452)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/66452
Test Plan: Imported from OSS
Reviewed By: ZolotukhinM
Differential Revision: D31557188
Pulled By: huiguoo
fbshipit-source-id: f18dfeba1df20d5d4f118640fc10782534eb9219