MCPcopy Create free account
hub / github.com/apple/coremltools / testBasicSaveLoad

Function testBasicSaveLoad

mlmodel/tests/SaveLoadTests.cpp:15–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13using namespace CoreML;
14
15int testBasicSaveLoad () {
16 Result r;
17
18 const std::string path("/tmp/a.modelasset");
19 OneHotEncoder ohe;
20 ML_ASSERT_GOOD(ohe.addInput("foo", FeatureType::String()));
21 ohe.getProto().mutable_onehotencoder()->mutable_stringcategories()->add_vector()->assign("foo");
22 ML_ASSERT_GOOD(ohe.addOutput("bar", FeatureType::Array({})));
23 ML_ASSERT_GOOD(ohe.save(path));
24 Model a2;
25 ML_ASSERT_GOOD(Model::load(path, a2));
26 ML_ASSERT_EQ(ohe, a2);
27 ML_ASSERT_EQ(std::remove(path.c_str()), 0);
28
29 return 0;
30}

Callers

nothing calls this directly

Calls 6

StringClass · 0.85
ArrayClass · 0.85
addOutputMethod · 0.80
loadFunction · 0.50
addInputMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected