Skip to content

Commit

Permalink
Update can_cast type
Browse files Browse the repository at this point in the history
  • Loading branch information
chongshenng committed Nov 6, 2024
1 parent 7bbca13 commit 9c60283
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/py/flwr/server/strategy/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ def aggregate_inplace(results: list[tuple[ClientProxy, FitRes]]) -> NDArrays:
num_examples_total = sum(fit_res.num_examples for (_, fit_res) in results)

# Compute scaling factors for each result
scaling_factors = [
fit_res.num_examples / num_examples_total for _, fit_res in results
]
scaling_factors = np.asarray(
[fit_res.num_examples / num_examples_total for _, fit_res in results]
)

def _try_inplace(
x: NDArray, y: Union[NDArray, float], np_binary_op: np.ufunc
x: NDArray, y: Union[NDArray, np.float64], np_binary_op: np.ufunc
) -> NDArray:
return ( # type: ignore[no-any-return]
np_binary_op(x, y, out=x)
Expand Down

0 comments on commit 9c60283

Please sign in to comment.