Skip to content

Commit cd5f2dd

Browse files
committed
Rename_normalize_weights_param_to_num_clients
1 parent 5e1b699 commit cd5f2dd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

machine_learning/federated_averaging.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ def _validate_clients(client_models: Sequence[Sequence[np.ndarray]]) -> None:
9090
)
9191

9292

93-
def _normalize_weights(weights: np.ndarray, n: int) -> np.ndarray:
94-
if weights.shape != (n,):
95-
raise ValueError(f"weights must have shape ({n},)")
93+
def _normalize_weights(weights: np.ndarray, num_clients: int) -> np.ndarray:
94+
if weights.shape != (num_clients,):
95+
raise ValueError(f"weights must have shape ({num_clients},)")
9696
if np.any(weights < 0):
9797
raise ValueError("weights must be non-negative")
9898
total = float(weights.sum())

0 commit comments

Comments
 (0)