Repository navigation
Commit a02897f
Silence numpy/torch warnings in camera and diff_geometry tests (#1595)
Summary:
Pull Request resolved: #1595
Two pymomentum unit tests emitted warnings on CI (surfaced by the OSS Windows pytest run):
1. `test_camera.py::test_fisheye_matches_numpy_reference` -- `RuntimeWarning: invalid value encountered in divide`. The numpy reference computed `np.where(r > 1e-8, theta_d / r, 1.0)`, but `np.where` evaluates both branches eagerly, so `theta_d / r` divided by zero for the on-axis point (`r == 0`). The bad values were discarded by the `where`, but the warning still fired. Guard the divisor with an inner `np.where` so the division never sees zero.
2. `test_diff_geometry.py::test_diffInverseParamTransform` -- `UserWarning` from `torch.autograd.gradcheck` about a non-double-precision input. The test built `modelParams` as float32 (missing `dtype=torch.float64`), so the derived `jointParams` passed to `gradcheck` was single precision, making the finite-difference check unreliable. Every other gradcheck test in the file already uses float64; add the missing dtype to match.
Both are test-only changes; no library behavior changes.
___
Differential Revision: D113866040
fbshipit-source-id: 41b065ac4b6d5407247eebbab866a31284cc5c951 parent 6f86f08 commit a02897f
2 files changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
456 | 456 | | |
457 | 457 | | |
458 | 458 | | |
459 | | - | |
| 459 | + | |
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
| |||
0 commit comments