diff --git a/onnxruntime/core/optimizer/qdq_transformer/selectors_actions/qdq_selector_action_transformer.cc b/onnxruntime/core/optimizer/qdq_transformer/selectors_actions/qdq_selector_action_transformer.cc index 71d4ddd38913b..2738c3ab02799 100644 --- a/onnxruntime/core/optimizer/qdq_transformer/selectors_actions/qdq_selector_action_transformer.cc +++ b/onnxruntime/core/optimizer/qdq_transformer/selectors_actions/qdq_selector_action_transformer.cc @@ -68,10 +68,14 @@ void DropQDQNodesRules(SelectorActionRegistry& qdq_selector_action_registry) { // And cannot eliminate the QDQ for MaxPool if the scale is not positive, as a negative // scale will change the ordering of the elements between quantized & de-quantized values. std::vector providers = {kCpuExecutionProvider, kDmlExecutionProvider}; + + // We don't drop the resample QDQ ops here for DML because we don't know yet whether it is allowed to be executed in DML. + // This will be done within DML during a graph pass if allowed, but otherwise we need to keep the dequantize op alive. + std::vector cpu_ep = {kCpuExecutionProvider}; std::unique_ptr selector_no_16bit = std::make_unique(false, false, true, - providers); + cpu_ep); qdq_selector_action_registry.RegisterSelectorAndAction(drop_action_no_int16_name, {{"Resize", {}}}, std::move(selector_no_16bit), @@ -143,7 +147,7 @@ void UnaryOpQDQRules(SelectorActionRegistry& qdq_selector_action_registry) { std::unique_ptr action = std::make_unique(kMSDomain); #if !defined(ORT_MINIMAL_BUILD) - std::vector providers = {kCpuExecutionProvider}; + std::vector providers = {kCpuExecutionProvider, kDmlExecutionProvider}; std::unique_ptr selector = std::make_unique(providers); qdq_selector_action_registry.RegisterSelectorAndAction(action_name, {{"AveragePool", {}},