Skip to content

Commit

Permalink
Add nan val check for barycenter features
Browse files Browse the repository at this point in the history
  • Loading branch information
pbarbarant committed May 22, 2024
1 parent 6015c8e commit 038fec6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/fugw/mappings/sparse_barycenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def update_barycenter_features(plans, weights_list, features_list, device):
else:
barycenter_features += acc

# Check for NaN values in the barycenter features
if torch.isnan(barycenter_features).any():
raise ValueError("Barycenter features contain NaN values")

return barycenter_features.T

@staticmethod
Expand Down

0 comments on commit 038fec6

Please sign in to comment.