You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let Pyre know that AcquisitionFunction.model is a Model (#1216)
Summary:
X-link: facebook/Ax#1216
## Motivation
Pyre is not smart enough to understand that calling `self.add_module('model', model)` makes `self.model` have the type of `model`, which is true due to some fairly complex underlying logic inherited from `torch.nn.Module`. However, PyTorch is smart enough to properly `add_module` if we just do `self.model = model`. This also works for tensors, but only if the tensor is explicitly registered as a buffer (by name, not necessarily by value) before assignment.
### Have you read the [Contributing Guidelines on pull requests]
Yes
Pull Request resolved: #1452
Test Plan:
- Unit tests should be unaffected
- Pyre error count drops from 1379 to 1309 (down 5%).
- Added explicit tests that `_modules` and `_buffers` are properly initialized
Reviewed By: Balandat
Differential Revision: D40469725
Pulled By: esantorella
fbshipit-source-id: 531cec5b77fc74faf478c4c96f1ceaa596ca8162
0 commit comments