Skip to content

Commit

Permalink
[hyperbolic] Fixed bug: stop optimization if max iter OR eps criteria is
Browse files Browse the repository at this point in the history
met
  • Loading branch information
GeometryCollective authored and katherineye committed Sep 9, 2020
1 parent 011275d commit 647ed05
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion react-renderer/src/Optimizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,15 @@ export const minimizeTF = (
let gradfx;
let vals;

while ((i < maxSteps) || (sc(normGrad) > EPS)) {
while( 1 ) {
energy = optimizer.minimize(() => f(...xs) as any, true);
gradfx = gradf(xs);
normGrad = tf.stack(gradfx).norm();

if( i >= maxSteps || (sc(normGrad) < EPS) ) {
break;
}

// note: this printing could tank the performance
if (DEBUG_OPT) {
vals = xs.map(v => v.dataSync()[0]);
Expand Down

0 comments on commit 647ed05

Please sign in to comment.