handle status

This commit is contained in:
Chi Lo 2025-02-06 17:25:22 -08:00
parent e95f2c3200
commit bad19b9c9e
2 changed files with 10 additions and 4 deletions

View file

@ -2670,10 +2670,15 @@ TensorrtExecutionProvider::GetCapability(const GraphViewer& graph,
*/
std::function<std::vector<std::unique_ptr<ComputeCapability>>(const GraphViewer&)> selection_func;
auto status = g_host->GetOptimizerByName("ConstantFoldingDQ", selection_func);
std::vector<std::unique_ptr<ComputeCapability>> selection_cc;
if (selection_func) {
selection_cc = selection_func(graph);
std::string optimizer_name = "ConstantFoldingDQ";
auto status = g_host->GetOptimizerByName(optimizer_name, selection_func);
if (status == Status::OK()) {
if (selection_func) {
selection_cc = selection_func(graph);
}
} else {
LOGS_DEFAULT(WARNING) << "[TensorRT EP] Can't get optimizer " << optimizer_name;
}
std::unordered_set<NodeIndex> trt_selection_node_set; // The qualified dq nodes selected by TRT EP

View file

@ -222,8 +222,9 @@ struct ProviderHostImpl : ProviderHost {
if (func.has_value()) {
selection_func = func.value();
} else {
return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "Failed to get optimizer " + optimizer_name);
}
return Status::OK();
};