A utility function to invoke a handler with input, output, and state feature description of the model. It traverses a pipeline model. The function returns `true` if any of the feature descriptions met the specified criteria predicate function.
| 134 | /// The function returns `true` if any of the feature descriptions met |
| 135 | /// the specified criteria predicate function. |
| 136 | static bool anyFeatureDescriptionOfModel(const Specification::Model &model, |
| 137 | std::function<bool(const Specification::FeatureDescription& fd)> criteria) { |
| 138 | return walkModelAndPipeline( |
| 139 | model, |
| 140 | [&criteria](const Specification::Model& m) { |
| 141 | const auto& modelDescription = m.description(); |
| 142 | if (modelDescription.functions_size() == 0) { |
| 143 | // A single function syntax |
| 144 | if (anyFeatureDescriptionOfDescription(modelDescription, criteria)) { |
| 145 | return true; |
| 146 | } |
| 147 | } else { |
| 148 | // A multi function syntax |
| 149 | for (const auto& functionDescription: modelDescription.functions()) { |
| 150 | if (anyFeatureDescriptionOfDescription(modelDescription, criteria)) { |
| 151 | return true; |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | return false; |
| 156 | }); |
| 157 | } |
| 158 | |
| 159 | bool CoreML::hasCustomLayer(const Specification::Model& model) { |
| 160 | return walkModelAndPipeline( |
no test coverage detected