Skip to content

Commit

Permalink
Fix min-max normalization equation
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmc2005 authored Oct 28, 2023
1 parent 637a5e2 commit b27cf1e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/diart/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@ def __call__(
) -> torch.Tensor:
# Normalize weights
if weights is not None:
weights -= weights.min(dim=1, keepdim=True).values
weights /= weights.max(dim=1, keepdim=True).values
min_values = weights.min(dim=1, keepdim=True).values
max_values = weights.max(dim=1, keepdim=True).values
weights = (weights - min_values) / (max_values - min_values)
weights.nan_to_num_(0.0)

if isinstance(self.model, nn.Module):
Expand Down

0 comments on commit b27cf1e

Please sign in to comment.