MCPcopy Create free account
hub / github.com/davisking/dlib / test_serialization

Function test_serialization

dlib/test/dnn.cpp:5314–5331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

run_testsMethod · 0.70

Calls 6

print_spinnerFunction · 0.85
serializeFunction · 0.70
deserializeFunction · 0.70
strMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected