Skip to content

Commit

Permalink
fix: mypy fixes for NumPy 1.20
Browse files Browse the repository at this point in the history
Fix mypy problems associated with NumPy 1.20.
  • Loading branch information
riddell-stan committed Feb 8, 2021
1 parent 8c6d97e commit 2a88910
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stan/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ def _parameter_indexes(self, param: str) -> Tuple[int, ...]:

def calculate_starts(dims: Tuple[Tuple[int, ...]]) -> Tuple[int, ...]:
"""Calculate starting indexes given dims."""
s = [np.prod(d) for d in dims]
s = [cast(int, np.prod(d)) for d in dims]
starts = np.cumsum([0] + s)[: len(dims)]
return tuple(int(i) for i in starts)

starts = tuple(sample_and_sampler_params_offset + i for i in calculate_starts(self.dims))
names_index = self.param_names.index(param)
flat_param_count = np.prod(self.dims[names_index])
flat_param_count = cast(int, np.prod(self.dims[names_index]))
return tuple(starts[names_index] + offset for offset in range(flat_param_count))

0 comments on commit 2a88910

Please sign in to comment.