blob: 7ec264b342fe63c958f56ca17a20c7b8d3ab37b6 [file] [log] [blame]
#include "caffe2/onnx/onnxifi_init.h"
#include <mutex>
#include "caffe2/core/logging.h"
namespace caffe2 {
namespace onnx {
onnxifi_library* initOnnxifiLibrary() {
static std::once_flag once;
static onnxifi_library core{};
std::call_once(once, []() {
auto ret =
onnxifi_load(ONNXIFI_LOADER_FLAG_VERSION_1_0, nullptr, nullptr, &core);
if (!ret) {
CAFFE_THROW("Cannot load onnxifi lib");
}
});
return &core;
}
} // namespace onnx
} // namespace caffe2