Created
August 10, 2020 01:47
-
-
Save rcurtin/2d25fd1a51148f3d022f708ddf8aa4b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From c98c6522eaeb18100a888819d55cf70f521923de Mon Sep 17 00:00:00 2001 | |
From: Ryan Curtin <ryan@ratml.org> | |
Date: Sun, 9 Aug 2020 21:46:42 -0400 | |
Subject: [PATCH 3/3] Revamp spill tree serialization; it seems to compile now. | |
--- | |
.../core/tree/spill_tree/spill_tree_impl.hpp | 14 +++++++++----- | |
1 file changed, 9 insertions(+), 5 deletions(-) | |
diff --git a/src/mlpack/core/tree/spill_tree/spill_tree_impl.hpp b/src/mlpack/core/tree/spill_tree/spill_tree_impl.hpp | |
index ec9c1dbdf..c160ee050 100644 | |
--- a/src/mlpack/core/tree/spill_tree/spill_tree_impl.hpp | |
+++ b/src/mlpack/core/tree/spill_tree/spill_tree_impl.hpp | |
@@ -905,18 +905,22 @@ void SpillTree<MetricType, StatisticType, MatType, HyperplaneType, SplitType>:: | |
} | |
ar & CEREAL_NVP(count); | |
- ar & CEREAL_NVP(pointsIndex); | |
+ ar & CEREAL_POINTER(pointsIndex); | |
ar & CEREAL_NVP(overlappingNode); | |
ar & CEREAL_NVP(hyperplane); | |
ar & CEREAL_NVP(bound); | |
ar & CEREAL_NVP(stat); | |
- ar & CEREAL_NVP(parent); | |
ar & CEREAL_NVP(parentDistance); | |
ar & CEREAL_NVP(furthestDescendantDistance); | |
- ar & CEREAL_NVP(dataset); | |
+ // Force a non-const pointer. | |
+ MatType* datasetPtr = const_cast<MatType*>(dataset); | |
+ ar & CEREAL_POINTER(datasetPtr); | |
if (Archive::is_loading::value) | |
+ { | |
+ dataset = datasetPtr; | |
localDataset = true; | |
+ } | |
// Save children last; otherwise cereal gets confused. | |
bool hasLeft = (left != NULL); | |
@@ -926,9 +930,9 @@ void SpillTree<MetricType, StatisticType, MatType, HyperplaneType, SplitType>:: | |
ar & CEREAL_NVP(hasRight); | |
if (hasLeft) | |
- ar & CEREAL_NVP(left); | |
+ ar & CEREAL_POINTER(left); | |
if (hasRight) | |
- ar & CEREAL_NVP(right); | |
+ ar & CEREAL_POINTER(right); | |
if (Archive::is_loading::value) | |
{ | |
-- | |
2.28.0.rc1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment