address comments
This commit is contained in:
parent
5129a4f2a6
commit
154f538a42
@ -766,12 +766,14 @@ TF_Library* TF_LoadPluggableDeviceLibrary(const char* library_filename,
|
|||||||
#else
|
#else
|
||||||
TF_Library* lib_handle = new TF_Library;
|
TF_Library* lib_handle = new TF_Library;
|
||||||
static tensorflow::mutex mu(tensorflow::LINKER_INITIALIZED);
|
static tensorflow::mutex mu(tensorflow::LINKER_INITIALIZED);
|
||||||
static std::unordered_map<std::string, void*> loaded_libs;
|
static std::unordered_map<std::string, void*>* loaded_libs =
|
||||||
|
new std::unordered_map<std::string, void*>();
|
||||||
tensorflow::Env* env = tensorflow::Env::Default();
|
tensorflow::Env* env = tensorflow::Env::Default();
|
||||||
{
|
{
|
||||||
tensorflow::mutex_lock lock(mu);
|
tensorflow::mutex_lock lock(mu);
|
||||||
if (loaded_libs.find(library_filename) != loaded_libs.end()) {
|
auto it = loaded_libs->find(library_filename);
|
||||||
lib_handle->lib_handle = loaded_libs[library_filename];
|
if (it != loaded_libs->end()) {
|
||||||
|
lib_handle->lib_handle = it->second;
|
||||||
} else {
|
} else {
|
||||||
status->status =
|
status->status =
|
||||||
env->LoadDynamicLibrary(library_filename, &lib_handle->lib_handle);
|
env->LoadDynamicLibrary(library_filename, &lib_handle->lib_handle);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
Loading…
Reference in New Issue
Block a user