Skip to content

Commit b0d954c

Browse files
ruijie-herjCadene
authored
Fix bug in normalize to avoid divide by zero (#239)
Co-authored-by: rj <[email protected]> Co-authored-by: Remi <[email protected]>
1 parent bd3111f commit b0d954c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lerobot/common/policies/normalize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def forward(self, batch: dict[str, Tensor]) -> dict[str, Tensor]:
147147
assert not torch.isinf(min).any(), _no_stats_error_str("min")
148148
assert not torch.isinf(max).any(), _no_stats_error_str("max")
149149
# normalize to [0,1]
150-
batch[key] = (batch[key] - min) / (max - min)
150+
batch[key] = (batch[key] - min) / (max - min + 1e-8)
151151
# normalize to [-1, 1]
152152
batch[key] = batch[key] * 2 - 1
153153
else:

0 commit comments

Comments
 (0)