[PyPer] copy-free freeze_module (#65118)
authorHao Lu <hlu@fb.com>
Mon, 20 Sep 2021 23:55:09 +0000 (16:55 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 21 Sep 2021 00:25:10 +0000 (17:25 -0700)
commitce101fed028e5e64a894b0245675042437493618
tree387802bbf12e23a2813f01e3b14266851c686241
parentca649851c6d4b942845defcd2c9a798fb4d0dd95
[PyPer] copy-free freeze_module (#65118)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/65118

Cloning the module can increase memory use. By freezing the module directly without cloning it first, we can avoid this memory usage increase.

Reviewed By: eellison, movefast1990

Differential Revision: D30955053

fbshipit-source-id: 2feb738eddcf66aa68c92bf695cc05b57bd990f0
benchmarks/static_runtime/test_static_runtime.cc
torch/csrc/jit/passes/freeze_module.cpp
torch/csrc/jit/passes/freeze_module.h
torch/csrc/jit/runtime/static/passes.cpp
torch/csrc/jit/runtime/static/passes.h