Fixing size implementation for struct slot_list_impl (#24351)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/24351
**Context:**
I was doing some exploration on APIs for jit script module internals.
I found there can be a bug(cannot cast Module to Slot) when I try to check size of sub_modules in one module. (please also provide suggestions if you think my diff is not optimal or wrong)
See the following:
for (auto m1 : module.get_modules()) { // module is the module loading from P79892263.
std::cout << "test module " << " " << m1.get_modules().size() << "\n";
}
With this change, its going to return 0 (expected)
Without this change, the following error will throw: P79892732
Also, I put a RFC here since I am looking for some ideas for any tests I should add, and where I should add those tests.
Reviewed By: smessmer
Differential Revision: D16803759
fbshipit-source-id: 1e2ae6b69d9790c700119d2d0b9f9f85f41616d4