Skip to content

Commit

Permalink
Extend lifetime of KernelDef when creating a standalone op (#12057)
Browse files Browse the repository at this point in the history
place tmp kernel def as local variable to cover the lifetime of kernel creation
  • Loading branch information
RandySheriffH authored Jul 1, 2022
1 parent 2e27a7e commit b858c2f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion onnxruntime/core/session/standalone_op_invoker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,12 @@ onnxruntime::Status CreateOp(const OrtKernelInfo* info,
kernel_def_builder->SetName(op_name);
kernel_def_builder->SetDomain(domain);
kernel_def_builder->SinceVersion(version);
auto kernel_def = kernel_def_builder->Build();

static std::unordered_map<int, OrtValue> kEmptyValueMap;
static OrtValueNameIdxMap kEmptyNameMap;

OpKernelInfo tmp_kernel_info(*node_ptr.get(), *kernel_def_builder->Build(), *ep, kEmptyValueMap, kEmptyNameMap, kernel_info->GetDataTransferManager());
OpKernelInfo tmp_kernel_info(*node_ptr.get(), *kernel_def, *ep, kEmptyValueMap, kEmptyNameMap, kernel_info->GetDataTransferManager());
std::unique_ptr<onnxruntime::OpKernel> op_kernel;

static FuncManager kFuncMgr;
Expand Down

0 comments on commit b858c2f

Please sign in to comment.