From 100d50089aec4e55fb711b1750ff06f48e31eda7 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 2 Oct 2024 17:34:57 -0400 Subject: [PATCH] Fix bugs in HollowBallBound implementation. --- src/mlpack/core/tree/hollow_ball_bound_impl.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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