pytorch
5431d87c - [JIT] Use `is_buffer` in `BufferPolicy::valid` (#49588)

Commit
3 years ago
[JIT] Use `is_buffer` in `BufferPolicy::valid` (#49588) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/49588 **Summary** `BufferPolicy::valid` uses `!typ->is_parameter(i)` to check if an attribute is a buffer or not; it should use `type->is_buffer(i)` instead. It also removes a forward compatibility gate in `python_print.cpp` that has prevented the preservation of buffer metadata during serialization in fbcode. Without this, the first change (to `BufferPolicy`) does not work correctly in fbcode. **Test Plan** It is difficult to write an additional test that would have failed before this commit because the two booleans `is_parameter` and `is_buffer` are never set to `true` at the same time. **Fixes** This commit fixes #48746. Test Plan: Imported from OSS Reviewed By: xw285cornell Differential Revision: D25633250 Pulled By: SplitInfinity fbshipit-source-id: e727f8506f16d2e2b28f3d76a655f6528e7ac6cb
Author
Meghan Lele
Parents
Loading