| 984 | } |
| 985 | |
| 986 | void Save(dmlc::Stream* fo) const override { |
| 987 | this->CheckModelInitialized(); |
| 988 | |
| 989 | Json memory_snapshot{Object()}; |
| 990 | memory_snapshot["Model"] = Object(); |
| 991 | auto& model = memory_snapshot["Model"]; |
| 992 | this->SaveModel(&model); |
| 993 | memory_snapshot["Config"] = Object(); |
| 994 | auto& config = memory_snapshot["Config"]; |
| 995 | this->SaveConfig(&config); |
| 996 | |
| 997 | std::vector<char> stream; |
| 998 | Json::Dump(memory_snapshot, &stream, std::ios::binary); |
| 999 | fo->Write(stream.data(), stream.size()); |
| 1000 | } |
| 1001 | |
| 1002 | void Load(dmlc::Stream* fi) override { |
| 1003 | common::PeekableInStream fp(fi); |
no test coverage detected