mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-07 04:39:07 +00:00
Fix leaking operator registry (#2645)
Fix https://microsoft.visualstudio.com/OS/_workitems/edit/24354916
This commit is contained in:
parent
1f35bcb68d
commit
13c2eb3524
2 changed files with 9 additions and 1 deletions
|
|
@ -126,7 +126,8 @@ void LearningModelSession::Initialize() {
|
|||
|
||||
// Register the custom operator registry
|
||||
auto model = model_.as<winmlp::LearningModel>();
|
||||
WINML_THROW_IF_FAILED(session->RegisterCustomRegistry(model->GetOperatorRegistry()));
|
||||
operatorRegistry_.reset(model->GetOperatorRegistry());
|
||||
WINML_THROW_IF_FAILED(session->RegisterCustomRegistry(operatorRegistry_.get()));
|
||||
|
||||
// Register only the transformers not already in ORT
|
||||
session->RegisterGraphTransformers();
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include "LearningModelSession.g.h"
|
||||
|
||||
#include "LearningModelBinding.h"
|
||||
#include "MLOperatorAuthor.h"
|
||||
#include "WinML_Lock.h"
|
||||
#include "WinMLAdapter.h"
|
||||
|
||||
|
|
@ -102,6 +103,12 @@ struct LearningModelSession : LearningModelSessionT<LearningModelSession> {
|
|||
|
||||
private:
|
||||
com_ptr<winmla::IInferenceSession> inference_session_;
|
||||
struct IMLOperatorRegistryDeleter {
|
||||
void operator()(IMLOperatorRegistry* p) {
|
||||
p->Release();
|
||||
}
|
||||
};
|
||||
std::unique_ptr<IMLOperatorRegistry, IMLOperatorRegistryDeleter> operatorRegistry_;
|
||||
|
||||
// reference to the active execution provider. weak
|
||||
onnxruntime::IExecutionProvider* cached_execution_provider_ = nullptr;
|
||||
|
|
|
|||
Loading…
Reference in a new issue