Commit 9904a3ae authored by Davis King's avatar Davis King

Made caching object a little more robust.

parent bb72961a
......@@ -65,7 +65,7 @@ namespace dlib
feature_vector_type& out_psi
) const
{
if (!skip_cache)
if (!skip_cache && prob->get_max_cache_size() != 0)
{
scalar_type best_risk = -std::numeric_limits<scalar_type>::infinity();
unsigned long best_idx = 0;
......@@ -102,6 +102,9 @@ namespace dlib
prob->separation_oracle(sample_idx, current_solution, out_loss, out_psi);
if (prob->get_max_cache_size() == 0)
return;
// if the cache is full
if (loss.size() >= prob->get_max_cache_size())
{
......
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