Skip to content

Commit b5d53f2

Browse files
igorsugakfacebook-github-bot
authored andcommitted
replace uses of np.ndarray with npt.NDArray (#681)
Summary: Pull Request resolved: #681 X-link: pytorch/captum#1389 X-link: pytorch/botorch#2586 X-link: pytorch/audio#3846 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: ```counterexample Generic type `ndarray` expects 2 type parameters. ``` `numpy.typing.NDArray` is an alias that provides default template parameters. Reviewed By: ryanthomasjohnson Differential Revision: D64619891 fbshipit-source-id: dffc096b1ce90d11e73d475f0bbcb8867ed9ef01
1 parent aea78b3 commit b5d53f2

File tree

1 file changed

+2
-1
lines changed
  • opacus/accountants/analysis/prv

1 file changed

+2
-1
lines changed

opacus/accountants/analysis/prv/prvs.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from typing import Tuple
1717

1818
import numpy as np
19+
import numpy.typing as npt
1920
from scipy import integrate
2021
from scipy.special import erfc
2122

@@ -133,7 +134,7 @@ def mean(self) -> float:
133134

134135
@dataclass
135136
class DiscretePRV:
136-
pmf: np.ndarray
137+
pmf: npt.NDArray
137138
domain: Domain
138139

139140
def __len__(self) -> int:

0 commit comments

Comments
 (0)