Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/tracksdata/metrics/_ctc_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ def _fill_empty(weights: sp.csr_array, fill_value: float) -> None:
Fill empty rows and columns of a sparse matrix with a small value.
"""
empty_rows = weights.sum(axis=1) == 0
empty_cols = weights.sum(axis=0) == 0 # find the empty rows before applying the fill_value

if empty_rows.any():
weights[empty_rows, :] = fill_value

empty_cols = weights.sum(axis=0) == 0
if empty_cols.any():
weights[:, empty_cols] = fill_value

Expand Down
Loading