Skip to content

Commit

Permalink
[WebNN EP] Disable clamp fusion for WebNN GPU (microsoft#18386)
Browse files Browse the repository at this point in the history
As which has not been supported in WebNN DirectML backend.
  • Loading branch information
Honry authored Nov 12, 2023
1 parent 8d298f6 commit cbf0cf0
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions onnxruntime/core/providers/webnn/builders/model_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ void ModelBuilder::PreprocessActivations() {
const auto& op_type(node->OpType());

if (op_type == "Clip") {
float minValue, maxValue;
GetClipMinMax(GetInitializerTensors(), *node, minValue, maxValue, logger_);
emscripten::val options = emscripten::val::object();
options.set("minValue", minValue);
options.set("maxValue", maxValue);
activation_nodes_.emplace(node->Index(), wnn_builder_.call<emscripten::val>("clamp", options));
// Temporarily disable clamp fusion for WebNN GPU as which is not supported yet.
if (wnn_device_type_ == WebnnDeviceType::CPU) {
float minValue, maxValue;
GetClipMinMax(GetInitializerTensors(), *node, minValue, maxValue, logger_);
emscripten::val options = emscripten::val::object();
options.set("minValue", minValue);
options.set("maxValue", maxValue);
activation_nodes_.emplace(node->Index(), wnn_builder_.call<emscripten::val>("clamp", options));
}
} else if (op_type == "Elu") {
NodeAttrHelper helper(*node);
emscripten::val options = emscripten::val::object();
Expand Down

0 comments on commit cbf0cf0

Please sign in to comment.