mirror of https://github.com/davisking/dlib.git
Fix find_max() going into an infinite loop in some cases when a non-differentiable function is given.
This commit is contained in:
parent
1eccfbc99a
commit
bd6dcc0b49
|
@ -272,6 +272,10 @@ namespace dlib
|
|||
throw error("The objective function generated non-finite outputs");
|
||||
if (!is_finite(g))
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue