tflite_runtime: Fix FlexDelegate on Windows
Added a logic to search "TF_AcquireFlexDelegate" function from _pywrap_tensorflow_interpreter_wrapper.pyd library. This CL fixes the GitHub issue #44237. PiperOrigin-RevId: 346241205 Change-Id: I5c77574ad9d4cb794e95d195398d68ecc8fd8752
This commit is contained in:
parent
8318ab26da
commit
485ac1a2af
@ -163,6 +163,12 @@ TFLITE_ATTRIBUTE_WEAK Interpreter::TfLiteDelegatePtr AcquireFlexDelegate() {
|
||||
#endif
|
||||
void* lib_tf_internal =
|
||||
SharedLibrary::LoadLibrary(filename_pywrap_tensorflow_internal);
|
||||
#if defined(_WIN32)
|
||||
if (lib_tf_internal == nullptr) {
|
||||
lib_tf_internal = SharedLibrary::LoadLibrary(
|
||||
"_pywrap_tensorflow_interpreter_wrapper.pyd");
|
||||
}
|
||||
#endif
|
||||
if (lib_tf_internal) {
|
||||
acquire_flex_delegate_func =
|
||||
reinterpret_cast<Interpreter::TfLiteDelegatePtr (*)()>(
|
||||
|
@ -36,6 +36,8 @@ class SharedLibrary {
|
||||
return reinterpret_cast<void*>(
|
||||
GetProcAddress(static_cast<HMODULE>(handle), symbol));
|
||||
}
|
||||
// Warning: Unlike dlsym(RTLD_DEFAULT), it doesn't search the symbol from
|
||||
// dependent DLLs.
|
||||
static inline void* GetSymbol(const char* symbol) {
|
||||
return reinterpret_cast<void*>(GetProcAddress(nullptr, symbol));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user