CreateScanKernel property

Pointer<NativeFunction<OrtStatusPtr Function(Pointer<OrtKernelInfo> kernel_info, Pointer<OrtScanKernelHelper> helper, Pointer<Pointer<OrtKernelImpl>> kernel_out)>> CreateScanKernel
getter/setter pair

\brief Creates an OrtKernelImpl instance for a Scan operator. Does not support opset versions older than 9.

Control flow operators require access to ORT session internals to orchestrate subgraph operations. This function allows an EP to create a properly configured OrtKernelImpl with access to ORT internals that the EP can add to its kernel registry.

It is recommended that an EP create an OrtKernelDef that keeps the inputs and outputs on the EP's device (i.e., OrtMemTypeDefault), which is the default setting, to avoid copying to/from CPU.

Example kernel definition (CXX API): Ort::KernelDef kernel_def = Ort::KernelDefBuilder() .SetDomain("").SetOperatorType("Scan").SetSinceVersion(21, 22) .SetExecutionProvider("MyEp") .SetInputMemType(0, OrtMemTypeDefault) // input0 on EP device .SetOutputMemType(0, OrtMemTypeDefault) // output0 on EP device .AddTypeConstraint("V", ...).Build();

\paramin kernel_info The ::OrtKernelInfo instance for a Scan node. This function returns error ORT_FAIL if the opset version specified by kernel_info is unsupported. \paramin helper A OrtScanKernelHelper instance that contains helper functions that ORT calls during kernel execution to operate on tensors allocated with the EP's device memory. ORT will call OrtScanKernelHelper::Release() to release the helper and its resources. \paramout kernel_out Output parameter set to the OrtKernelImpl instance for the Scan node. Must be released via ::ReleaseKernelImpl, unless ownership is transferred to ORT (see OrtKernelCreateFunc and ::KernelRegistry_AddKernel()).

\snippet{doc} snippets.dox OrtStatus Return Value \since Version 1.24

Implementation

external ffi.Pointer<
  ffi.NativeFunction<
    OrtStatusPtr Function(
      ffi.Pointer<OrtKernelInfo> kernel_info,
      ffi.Pointer<OrtScanKernelHelper> helper,
      ffi.Pointer<ffi.Pointer<OrtKernelImpl>> kernel_out,
    )
  >
>
CreateScanKernel;