File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,11 @@ LiteRtStatus LiteRtSetOptionsHardwareAccelerators(
4747 LRT_CHECK_NON_NULL (options);
4848 if ((hardware_accelerators &
4949 (kLiteRtHwAcceleratorCpu | kLiteRtHwAcceleratorGpu |
50- kLiteRtHwAcceleratorNpu )) != hardware_accelerators) {
50+ kLiteRtHwAcceleratorNpu
51+ #ifdef __EMSCRIPTEN__
52+ | kLiteRtHwAcceleratorWebNn
53+ #endif // __EMSCRIPTEN__
54+ )) != hardware_accelerators) {
5155 LITERT_LOG (LITERT_ERROR,
5256 " Invalid bitfield value for hardware accelerator set: %d." ,
5357 hardware_accelerators);
Original file line number Diff line number Diff line change @@ -187,6 +187,15 @@ Expected<void> LiteRtCompiledModelT::InitializeRuntime(
187187 resolver.AddCustom (op_name, &sStubRegistration );
188188 }
189189 }
190+ #ifdef __EMSCRIPTEN__
191+ else if (hardware_accelerators & kLiteRtHwAcceleratorWebNn ) {
192+ const char * accelerator_supported_custom_ops[] = {
193+ " Convolution2DTransposeBias" };
194+ for (const auto & op_name : accelerator_supported_custom_ops) {
195+ resolver.AddCustom (op_name, &sStubRegistration );
196+ }
197+ }
198+ #endif // __EMSCRIPTEN__
190199
191200 tflite::InterpreterOptions interpreter_options;
192201 interpreter_options.SetUseSignatureTensorNames (true );
You can’t perform that action at this time.
0 commit comments