Open pre-commit-ci[bot] opened 1 month ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 98.21%. Comparing base (
aab3468
) to head (1f451bd
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Looks like there's a slightly different type coercion needed here (taking one as an example0
src/pyhf/tensor/numpy_backend.py:38: error: Argument 2 to "poisson_logpdf" of "numpy_backend" has incompatible type
got:
"Union[ndarray[Any, dtype[number[T@__init__]]], ndarray[Any, dtype[bool]]]"
expected:
"Union[ndarray[Any, dtype[number[T@log_prob]]], ndarray[Any, dtype[bool]]]"
so need to dig into why. The @
notation is throwing me off a little (must be related to the generics). /cc @henryiii or @alexander-held if they've seen this before.
with this code
class _BasicPoisson:
def __init__(self, rate: Tensor[T]):
self.rate = rate
def sample(self, sample_shape: Shape) -> ArrayLike:
return poisson(self.rate).rvs(size=sample_shape + self.rate.shape) # type: ignore[no-any-return]
def log_prob(self, value: NDArray[np.number[T]]) -> ArrayLike:
tensorlib: numpy_backend[T] = numpy_backend()
return tensorlib.poisson_logpdf(value, self.rate)
here, it seems to complain about self.rate
which is typed as Tensor[T]
.
updates: