pytorch / botorch

Bayesian optimization in PyTorch
https://botorch.org/
MIT License
3.11k stars 406 forks source link

replace uses of np.ndarray with npt.NDArray (#2584) #2586

Closed igorsugak closed 1 month ago

igorsugak commented 1 month ago

Summary: X-link: https://github.com/pytorch/audio/pull/3846

X-link: https://github.com/pytorch/opacus/pull/680 X-link: https://github.com/pytorch/captum/pull/1387 X-link: https://github.com/pytorch/audio/pull/3845

This replaces uses of numpy.ndarray in type annotations with numpy.typing.NDArray. In Numpy-1.24.0+ numpy.ndarray is annotated as generic type. Without template parameters it triggers static analysis errors:

Generic type `ndarray` expects 2 type parameters.

numpy.typing.NDArray is an alias that provides default template parameters.

Differential Revision: D64619891

facebook-github-bot commented 1 month ago

This pull request was exported from Phabricator. Differential Revision: D64619891

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.98%. Comparing base (d2c6f5e) to head (361e730). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2586 +/- ## ======================================= Coverage 99.98% 99.98% ======================================= Files 196 196 Lines 17333 17340 +7 ======================================= + Hits 17331 17338 +7 Misses 2 2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

facebook-github-bot commented 1 month ago

This pull request has been merged in pytorch/botorch@748672a10e3546e0d97493851e7caa679af27632.