mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16047 Implements single thead safe map enabling sharing of generated graph between different ops. Added model_id to every onnxified op to help create a unique id in the map. Some formatting fix. Reviewed By: yinghai Differential Revision: D13663927 fbshipit-source-id: 27417e8fe752fdd48abb6a87966cd76d592e1206
23 lines
473 B
C++
23 lines
473 B
C++
#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, &core);
|
|
if (!ret) {
|
|
CAFFE_THROW("Cannot load onnxifi lib");
|
|
}
|
|
});
|
|
return &core;
|
|
}
|
|
} // namespace onnx
|
|
} // namespace caffe2
|