[SR] Introduce StaticMethod (#67981)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/67981
To save on memory, various internal classes need to release all references to their `torch::jit::Module` after constructing their `StaticModule`. Unfortunately, many of these classes currently instantiate a `torch::jit::Method` attribute, which holds a reference to the `ivalue` backing its owning module.
To avoid this, I've introduced a new subclass of `IMethod` to represent scripted functions backed by static runtime.
Test Plan: CI
Reviewed By: swolchok
Differential Revision: D32232039
fbshipit-source-id: 434b3a1a4b893b2c4e6cacbee60fa48bd33b5722