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

Function test_serialization

dlib/test/dnn.cpp:4742–4759  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4740
4741
4742 void test_serialization()
4743 {
4744 print_spinner();
4745
4746 using net_type = loss_mean_squared<fc<1, input<matrix<double>>>>;
4747 net_type net, net2;
4748
4749 std::ostringstream out;
4750 serialize(net, out);
4751 const std::string serialized = out.str();
4752 std::istringstream in(serialized);
4753 dlib::deserialize(net2, in);
4754
4755 std::vector<char> buf1;
4756 dlib::serialize(buf1) << net;
4757 std::vector<uint8_t> buf2(buf1.begin(), buf1.end());
4758 dlib::deserialize(buf2) >> net2;
4759 }
4760
4761// ----------------------------------------------------------------------------------------
4762

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