diff --git a/src/mlpack/core/tree/hollow_ball_bound_impl.hpp b/src/mlpack/core/tree/hollow_ball_bound_impl.hpp index 4d65a0aeec..41d3122234 100644 --- a/src/mlpack/core/tree/hollow_ball_bound_impl.hpp +++ b/src/mlpack/core/tree/hollow_ball_bound_impl.hpp @@ -316,8 +316,8 @@ RangeType HollowBallBound::RangeDistance( typename std::enable_if_t::value>* /* junk */) const { if (radii.Hi() < 0) - return Range(std::numeric_limits::max(), - std::numeric_limits::max()); + return RangeType(std::numeric_limits::max(), + std::numeric_limits::max()); else { RangeType range; @@ -461,7 +461,7 @@ void HollowBallBound::serialize( ar(CEREAL_NVP(radii)); ar(CEREAL_NVP(center)); ar(CEREAL_NVP(hollowCenter)); - ar(CEREAL_POINTER(distance)); + if (cereal::is_loading()) { // If we're loading, delete the local distance since we'll have a new one. @@ -470,6 +470,8 @@ void HollowBallBound::serialize( ownsDistance = true; } + + ar(CEREAL_POINTER(distance)); } } // namespace mlpack