pytorch
4d89489d - Move static checks of layers[0] (e.g., isinstance check) to model build time (#102045)

Commit
2 years ago
Move static checks of layers[0] (e.g., isinstance check) to model build time (#102045) Summary: Move static checks of layers[0] (e.g., isinstance check) to model build time because isinstance() does not work for torchscripted code. Because the validation is now performed while constructing the object, the isinstance() call is performed in eager mode at model build time, and we avoid needing to call isinstance() at runtime to determine whether the layers in a model are an instance of the TransformerEncoderLayer class, or its derived classes. Test Plan: sandcastle, github Differential Revision: D46096222 Pull Request resolved: https://github.com/pytorch/pytorch/pull/102045 Approved by: https://github.com/mikaylagawarecki
Author
Michael Gschwind
Committer
Parents
Loading