()
| 37 | from coremltools.models.neural_network import NeuralNetworkBuilder |
| 38 | |
| 39 | def create_coreml_model(): |
| 40 | shape = (2,) |
| 41 | alpha = 2 |
| 42 | |
| 43 | inputs = [ |
| 44 | ("input0", coremltools.models.datatypes.Array(*shape)), |
| 45 | ("input1", coremltools.models.datatypes.Array(*shape)), |
| 46 | ] |
| 47 | outputs = [ |
| 48 | ("output0", coremltools.models.datatypes.Array(*shape)), |
| 49 | ("output1", coremltools.models.datatypes.Array(*shape)), |
| 50 | ] |
| 51 | builder = NeuralNetworkBuilder(inputs, outputs) |
| 52 | builder.add_elementwise( |
| 53 | name="Add", input_names=["input0", "input1"], output_name="output0", mode="ADD" |
| 54 | ) |
| 55 | builder.add_elementwise( |
| 56 | name="Mul", alpha=alpha, input_names=["input0"], output_name="output1", mode="MULTIPLY" |
| 57 | ) |
| 58 | return coremltools.models.MLModel(builder.spec) |
| 59 | |
| 60 | def verify(coreml_model, model_path, dev): |
| 61 | coreml_model = create_coreml_model() |
no outgoing calls
no test coverage detected
searching dependent graphs…