Skip to content

Commit

Permalink
check cache-key
Browse files Browse the repository at this point in the history
  • Loading branch information
wejoncy committed Dec 16, 2024
1 parent 26775b4 commit 89317c6
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ CoreMLExecutionProvider::GetCapability(const onnxruntime::GraphViewer& graph_vie
}
if (main_graph->GetModel().MetaData().count(kCOREML_CACHE_KEY) > 0) {
user_provided_key = graph_viewer.GetGraph().GetModel().MetaData().at(kCOREML_CACHE_KEY);
if (user_provided_key.size() > 32 ||
std::count_if(user_provided_key.begin(), user_provided_key.end(),
[](unsigned char c) { return std::isalnum(c); })) {
user_provided_key = std::to_string(std::hash<std::string>{}(user_provided_key));
}
} else {
// model_hash is a 64-bit hash value of model_path if model_path is not empty,
// otherwise it hashes the graph input names and all the node output names.
Expand Down

0 comments on commit 89317c6

Please sign in to comment.