| 4042 | } |
| 4043 | |
| 4044 | int testSpecDowngrade() { |
| 4045 | |
| 4046 | Specification::Model m1; |
| 4047 | m1.set_specificationversion(MLMODEL_SPECIFICATION_VERSION); |
| 4048 | |
| 4049 | auto *topIn = m1.mutable_description()->add_input(); |
| 4050 | topIn->set_name("input"); |
| 4051 | auto *shape = topIn->mutable_type()->mutable_multiarraytype(); |
| 4052 | shape->set_datatype(Specification::ArrayFeatureType_ArrayDataType_DOUBLE); |
| 4053 | shape->add_shape(10); |
| 4054 | shape->add_shape(11); |
| 4055 | shape->add_shape(12); |
| 4056 | |
| 4057 | auto *out = m1.mutable_description()->add_output(); |
| 4058 | out->set_name("probs"); |
| 4059 | auto *outvec = out->mutable_type()->mutable_multiarraytype(); |
| 4060 | outvec->set_datatype(Specification::ArrayFeatureType_ArrayDataType_DOUBLE); |
| 4061 | |
| 4062 | const auto nn = m1.mutable_neuralnetwork(); |
| 4063 | |
| 4064 | Specification::NeuralNetworkLayer *layer = nn->add_layers(); |
| 4065 | layer->add_input("input"); |
| 4066 | layer->add_output("probs"); |
| 4067 | auto *params = layer->mutable_slice(); |
| 4068 | |
| 4069 | params->set_startindex(5); |
| 4070 | // The validator can't know if the input is big enough for this or not |
| 4071 | params->set_endindex(-3); |
| 4072 | params->set_stride(2); |
| 4073 | |
| 4074 | Result res = validate<MLModelType_neuralNetwork>(m1); |
| 4075 | ML_ASSERT_GOOD(res); |
| 4076 | |
| 4077 | Model mlmodel = Model(m1); |
| 4078 | |
| 4079 | ML_ASSERT(mlmodel.getProto().specificationversion() == MLMODEL_SPECIFICATION_VERSION_IOS11); |
| 4080 | |
| 4081 | return 0; |
| 4082 | |
| 4083 | } |
| 4084 | |
| 4085 | int testSpecDowngradefp16() { |
| 4086 | |