mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-06 00:03:22 +00:00
Fix custom ops scenario tests (#2562)
* Do not shutdown protobuf after ort environment gets destroyed. Lazy load lotus environment first time it is needed * comment typo * pr comment about calling phoenix singleton * Make lotus_environment static in winmladapter
This commit is contained in:
parent
8294fa72a4
commit
9933b8a5d6
1 changed files with 7 additions and 3 deletions
|
|
@ -262,12 +262,15 @@ class WinMLAdapter : public Microsoft::WRL::RuntimeClass<
|
|||
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
|
||||
IWinMLAdapter> {
|
||||
private:
|
||||
std::shared_ptr<WinML::LotusEnvironment> lotus_environment_;
|
||||
// TODO: Making this static is only temporary. A fix addressing the resulting the memory leaks is needed.
|
||||
static std::shared_ptr<WinML::LotusEnvironment> lotus_environment_;
|
||||
|
||||
public:
|
||||
WinMLAdapter() : lotus_environment_(PheonixSingleton<WinML::LotusEnvironment>()) {
|
||||
WinMLAdapter() {
|
||||
if (lotus_environment_ == nullptr) {
|
||||
lotus_environment_ = PheonixSingleton<WinML::LotusEnvironment>();
|
||||
}
|
||||
}
|
||||
|
||||
// factory methods for creating an ort model from a path
|
||||
HRESULT STDMETHODCALLTYPE CreateModelProto(
|
||||
const char* path,
|
||||
|
|
@ -644,6 +647,7 @@ class WinMLAdapter : public Microsoft::WRL::RuntimeClass<
|
|||
}
|
||||
WINML_CATCH_ALL_COM
|
||||
}; // namespace Windows::AI::MachineLearning::Adapter
|
||||
std::shared_ptr<WinML::LotusEnvironment> WinMLAdapter::lotus_environment_ = nullptr;
|
||||
|
||||
extern "C" HRESULT STDMETHODCALLTYPE OrtGetWinMLAdapter(IWinMLAdapter** adapter) try {
|
||||
// make an adapter instance
|
||||
|
|
|
|||
Loading…
Reference in a new issue