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

Method save

mlmodel/src/Model.cpp:192–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190 }
191
192 Result Model::save(std::ostream& out) {
193 if (!out.good()) {
194 return Result(ResultType::UNABLE_TO_OPEN_FILE,
195 "unable to open file for write");
196 }
197
198 // Before saving the model, always downgrade the specification version to
199 // the minimal version supporting everything this model needs
200 downgradeSpecificationVersion();
201
202 // validate on save
203 Result r = validate();
204 if (!r.good()) {
205 return r;
206 }
207
208 return saveSpecification(*m_spec, out);
209 }
210
211 Result Model::save(const std::string& path) {
212 std::ofstream out(path, std::ios::binary);

Callers 7

saveSpecificationPathFunction · 0.45
testTreeEnsembleBasicFunction · 0.45
testBasicSaveLoadFunction · 0.45

Calls 4

ResultClass · 0.85
validateFunction · 0.85
saveSpecificationFunction · 0.85
goodMethod · 0.80

Tested by 3

testTreeEnsembleBasicFunction · 0.36
testBasicSaveLoadFunction · 0.36