| 5312 | |
| 5313 | |
| 5314 | void test_serialization() |
| 5315 | { |
| 5316 | print_spinner(); |
| 5317 | |
| 5318 | using net_type = loss_mean_squared<fc<1, input<matrix<double>>>>; |
| 5319 | net_type net, net2; |
| 5320 | |
| 5321 | std::ostringstream out; |
| 5322 | serialize(net, out); |
| 5323 | const std::string serialized = out.str(); |
| 5324 | std::istringstream in(serialized); |
| 5325 | dlib::deserialize(net2, in); |
| 5326 | |
| 5327 | std::vector<char> buf1; |
| 5328 | dlib::serialize(buf1) << net; |
| 5329 | std::vector<uint8_t> buf2(buf1.begin(), buf1.end()); |
| 5330 | dlib::deserialize(buf2) >> net2; |
| 5331 | } |
| 5332 | |
| 5333 | // ---------------------------------------------------------------------------------------- |
| 5334 |
no test coverage detected