"...io/image/git@developer.sourcefind.cn:OpenDAS/vision.git" did not exist on "61d97f41bc209e1407dcfbd685d2ee2da9c1cdad"
Commit bd6dcc0b authored by Davis King's avatar Davis King
Browse files

Fix find_max() going into an infinite loop in some cases when a...

Fix find_max() going into an infinite loop in some cases when a non-differentiable function is given.
parent 1eccfbc9
...@@ -272,6 +272,10 @@ namespace dlib ...@@ -272,6 +272,10 @@ namespace dlib
throw error("The objective function generated non-finite outputs"); throw error("The objective function generated non-finite outputs");
if (!is_finite(g)) if (!is_finite(g))
throw error("The objective function generated non-finite outputs"); throw error("The objective function generated non-finite outputs");
// Gradient is zero, no more progress is possible. So stop.
if (alpha == 0)
break;
} }
return -f_value; return -f_value;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment