Skip to content

Commit cb930e5

Browse files
committed
fix len bug for std calc.
1 parent 19364f0 commit cb930e5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sbi/analysis/sensitivity_analysis.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ def destandardizing_net(batch_t: Tensor, min_std: float = 1e-7) -> nn.Module:
4747
is_valid_t, *_ = handle_invalid_x(batch_t, True)
4848

4949
t_mean = torch.mean(batch_t[is_valid_t], dim=0)
50-
if len(batch_t > 1):
50+
51+
# Use batch size to decide whether a reliable std can be computed.
52+
if len(batch_t) > 1:
5153
t_std = torch.std(batch_t[is_valid_t], dim=0)
5254
t_std[t_std < min_std] = min_std
5355
else:

0 commit comments

Comments
 (0)