Skip to content

Commit

Permalink
re-fix of old silent error (loss shape broadcast mismatch caused by e…
Browse files Browse the repository at this point in the history
…xtra dim of size 1) (#1063)

fixed shapes error in normalfactor to squeeze when  dim(-1)=1 and no gating
  • Loading branch information
shreyasc30 authored Aug 21, 2024
1 parent e9de7ce commit 1d20130
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bliss/encoder/variational_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ def compute_nll(self, params, true_tile_cat):
target = torch.where(gating.unsqueeze(-1), target, 0)
assert not torch.isnan(target).any()
ungated_nll = -qk.log_prob(target)
if ungated_nll.dim() == target.dim(): # (b, w, h, 1) -> (b,w,h) silent error
ungated_nll = ungated_nll.squeeze(-1)
return ungated_nll * gating


Expand Down

0 comments on commit 1d20130

Please sign in to comment.