Skip to content

Commit

Permalink
use GetMayInplace in CreateKernelCreateInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
jslhcl committed Mar 22, 2024
1 parent 7e84ba0 commit 34dc5ec
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions onnxruntime/core/session/custom_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,17 @@ KernelCreateInfo CreateKernelCreateInfo(const std::string& domain, const OrtCust
def_builder.Provider(onnxruntime::kCpuExecutionProvider);
}

if (op->version >= 18) {
int* input_index = nullptr;
int* output_index = nullptr;
size_t len = op->GetMayInplace(&input_index, &output_index);
if (len > 0) {
for (int i = 0; i < len; i++) def_builder.MayInplace(input_index[i], output_index[i]);
free(input_index);
free(output_index);
}
}

KernelCreateFn kernel_create_fn = [op](FuncManager&, const OpKernelInfo& info,
std::unique_ptr<OpKernel>& out) -> Status {
out = std::make_unique<CustomOpKernel>(info, *op);
Expand Down

0 comments on commit 34dc5ec

Please sign in to comment.