[WebNN EP] Use identity for one input of Max/Min (#21974)

Now WebNN supports `identity` op, use it for `Max` and `Min` ops with
only one input.
This commit is contained in:
Wanming Lin 2024-09-06 07:47:40 +08:00 коммит произвёл GitHub
Родитель 20c802afd4
Коммит 23f6604c39
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 2 добавлений и 5 удалений

Просмотреть файл

@ -47,11 +47,8 @@ Status MaxMinOpBuilder::AddToModelBuilderImpl(ModelBuilder& model_builder,
options.set("label", node.Name());
if (input_count == 1) {
// For 1 input, just concat the single input as workaround.
// TODO: use identity instead once it's available in WebNN.
emscripten::val inputs = emscripten::val::array();
inputs.call<void>("push", input0);
output = model_builder.GetBuilder().call<emscripten::val>("concat", inputs, 0, options);
// For 1 input, use identity instead.
output = model_builder.GetBuilder().call<emscripten::val>("identity", input0, options);
} else {
std::string webnn_op_name = op_type == "Max" ? "max" : "min";