Commit ·
bf30b9b
1
Parent(s): 206b280
Apply pre-commit formatting (yapf) [skip-build]
Browse filesCo-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
torch-ext/optimizer/newton_schulz.py
CHANGED
|
@@ -40,9 +40,8 @@ def _optimal_quintic(l, u, max_iter=1000):
|
|
| 40 |
])
|
| 41 |
a, b, c, E = np.linalg.solve(LHS, np.ones(4))
|
| 42 |
if not np.all(np.isfinite([a, b, c, E])):
|
| 43 |
-
raise ValueError(
|
| 44 |
-
|
| 45 |
-
f"a={a}, b={b}, c={c}, E={E}")
|
| 46 |
q, r = np.sqrt(
|
| 47 |
(-3 * b + np.array([-1, 1]) * sqrt(9 * b**2 - 20 * a * c)) /
|
| 48 |
(10 * c))
|
|
|
|
| 40 |
])
|
| 41 |
a, b, c, E = np.linalg.solve(LHS, np.ones(4))
|
| 42 |
if not np.all(np.isfinite([a, b, c, E])):
|
| 43 |
+
raise ValueError(f"_optimal_quintic: non-finite solve result "
|
| 44 |
+
f"a={a}, b={b}, c={c}, E={E}")
|
|
|
|
| 45 |
q, r = np.sqrt(
|
| 46 |
(-3 * b + np.array([-1, 1]) * sqrt(9 * b**2 - 20 * a * c)) /
|
| 47 |
(10 * c))
|