pytorch / opacus

Training PyTorch models with differential privacy
https://opacus.ai
Apache License 2.0
1.72k stars 345 forks source link

replace uses of np.ndarray with npt.NDArray (#680) #681

Closed igorsugak closed 1 month ago

igorsugak commented 1 month ago

Summary: X-link: https://github.com/pytorch/captum/pull/1389

X-link: https://github.com/pytorch/botorch/pull/2586

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

X-link: https://github.com/pytorch/captum/pull/1387 X-link: https://github.com/pytorch/botorch/pull/2584 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

facebook-github-bot commented 1 month ago

This pull request has been merged in pytorch/opacus@b5d53f26e90ea42e6c413ae69902647907c7ddbe.