added reading cell storage in customizer
This commit is contained in:
committed by
Patrick Niklaus
parent
ec3cda32fa
commit
dff8c48842
@@ -33,6 +33,9 @@ using CellStorageView = detail::CellStorageImpl<true>;
|
||||
namespace io
|
||||
{
|
||||
template <bool UseShareMemory>
|
||||
inline void read(const boost::filesystem::path &path,
|
||||
detail::CellStorageImpl<UseShareMemory> &storage);
|
||||
template <bool UseShareMemory>
|
||||
inline void write(const boost::filesystem::path &path,
|
||||
const detail::CellStorageImpl<UseShareMemory> &storage);
|
||||
}
|
||||
@@ -346,6 +349,8 @@ template <bool UseShareMemory> class CellStorageImpl
|
||||
cells[cell_index], weights.data(), source_boundary.data(), destination_boundary.data()};
|
||||
}
|
||||
|
||||
friend void io::read<UseShareMemory>(const boost::filesystem::path &path,
|
||||
detail::CellStorageImpl<UseShareMemory> &storage);
|
||||
friend void io::write<UseShareMemory>(const boost::filesystem::path &path,
|
||||
const detail::CellStorageImpl<UseShareMemory> &storage);
|
||||
|
||||
|
||||
@@ -33,6 +33,18 @@ template <> inline void write(const boost::filesystem::path &path, const MultiLe
|
||||
writer.SerializeVector(mlp.cell_to_children);
|
||||
}
|
||||
|
||||
template <> inline void read(const boost::filesystem::path &path, CellStorage &storage)
|
||||
{
|
||||
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
|
||||
storage::io::FileReader reader{path, fingerprint};
|
||||
|
||||
reader.DeserializeVector(storage.weights);
|
||||
reader.DeserializeVector(storage.source_boundary);
|
||||
reader.DeserializeVector(storage.destination_boundary);
|
||||
reader.DeserializeVector(storage.cells);
|
||||
reader.DeserializeVector(storage.level_to_cell_offset);
|
||||
}
|
||||
|
||||
template <> inline void write(const boost::filesystem::path &path, const CellStorage &storage)
|
||||
{
|
||||
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
|
||||
|
||||
Reference in New Issue
Block a user