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

Function buildEmptyPipelineModel

mlmodel/tests/ModelCreationUtils.cpp:342–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

340}
341
342Specification::Pipeline* buildEmptyPipelineModel(Specification::Model& m, bool isUpdatable, const TensorAttributes *inTensorAttr, const TensorAttributes *outTensorAttr) {
343 auto inTensor = m.mutable_description()->add_input();
344 inTensor->set_name(inTensorAttr->name);
345 auto inTensorShape = inTensor->mutable_type()->mutable_multiarraytype();
346 inTensorShape->set_datatype(Specification::ArrayFeatureType_ArrayDataType_FLOAT32);
347 for (int i = 0; i < inTensorAttr->dimension; i++) {
348 inTensorShape->add_shape(1);
349 }
350
351 auto outTensor = m.mutable_description()->add_output();
352 outTensor->set_name(outTensorAttr->name);
353 auto outTensorShape = outTensor->mutable_type()->mutable_multiarraytype();
354 outTensorShape->set_datatype(Specification::ArrayFeatureType_ArrayDataType_FLOAT32);
355 for (int i = 0; i < outTensorAttr->dimension; i++) {
356 outTensorShape->add_shape(1);
357 }
358
359 m.set_specificationversion(MLMODEL_SPECIFICATION_VERSION_IOS13);
360
361 auto pipeline = m.mutable_pipeline();
362
363 if (isUpdatable) {
364 m.set_isupdatable(true);
365 }
366
367 return pipeline;
368}
369
370Specification::Pipeline* buildEmptyPipelineModelWithStringOutput(Specification::Model& m, bool isUpdatable, const TensorAttributes *inTensorAttr, const char *outTensorName) {
371 auto inTensor = m.mutable_description()->add_input();

Calls 1

set_nameMethod · 0.45

Tested by

no test coverage detected