| 13 | using namespace CoreML; |
| 14 | |
| 15 | int 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 | } |