OrtCustomOp class final

The OrtCustomOp structure defines a custom op's schema and its kernel callbacks. The callbacks are filled in by the implementor of the custom op.

Inheritance
Implemented types
Available extensions

Constructors

OrtCustomOp()

Properties

address Pointer<T>

Available on T, provided by the StructAddress extension

The memory address of the underlying data.
no setter
CreateKernel Pointer<NativeFunction<Pointer<Void> Function(Pointer<OrtCustomOp> op, Pointer<OrtApi> api, Pointer<OrtKernelInfo> info)>>
This callback creates the kernel, which is a user defined parameter that is passed to the Kernel* callbacks below. It is recommended to use CreateKernelV2 which allows for a safe error propagation by returning an OrtStatusPtr.
getter/setter pair
CreateKernelV2 Pointer<NativeFunction<OrtStatusPtr Function(Pointer<OrtCustomOp> op, Pointer<OrtApi> api, Pointer<OrtKernelInfo> info, Pointer<Pointer<Void>> kernel)>>
Create the kernel state which is passed to each compute call.
getter/setter pair
GetAliasMap Pointer<NativeFunction<Size Function(Pointer<Pointer<Int>> input_index, Pointer<Pointer<Int>> output_index)>>
Same as GetMayInplace() and ReleaseMayInplace()
getter/setter pair
GetEndVersion Pointer<NativeFunction<Int Function(Pointer<OrtCustomOp> op)>>
getter/setter pair
GetExecutionProviderType Pointer<NativeFunction<Pointer<Char> Function(Pointer<OrtCustomOp> op)>>
Returns the type of the execution provider, return nullptr to use CPU execution provider
getter/setter pair
GetInputCharacteristic Pointer<NativeFunction<UnsignedInt Function(Pointer<OrtCustomOp> op, Size index)>>
Returns the characteristics of the input & output tensors
getter/setter pair
GetInputMemoryType Pointer<NativeFunction<Int Function(Pointer<OrtCustomOp> op, Size index)>>
Returns the memory type of the input tensors. This API allows the custom op to place the inputs on specific devices. By default, it returns OrtMemTypeDefault, which means the input is placed on the default device for the execution provider. If the inputs need to be with different memory types, this function can be overridden to return the specific memory types.
getter/setter pair
GetInputType Pointer<NativeFunction<UnsignedInt Function(Pointer<OrtCustomOp> op, Size index)>>
Returns the count and types of the input & output tensors
getter/setter pair
GetInputTypeCount Pointer<NativeFunction<Size Function(Pointer<OrtCustomOp> op)>>
getter/setter pair
GetMayInplace Pointer<NativeFunction<Size Function(Pointer<Pointer<Int>> input_index, Pointer<Pointer<Int>> output_index)>>
Get the inplace_map that defines which output can reuse which input Callers will provide 2 raw int* and pass in their address, this function will fill these 2 arrays when return, output (*output_index)i may reuse the input (*input_indexi). The return value is the size of these 2 arrays. Callers are responsible to delete these 2 arrays after use by calling OrtCustomOp::ReleaseMayInplace().
getter/setter pair
GetName Pointer<NativeFunction<Pointer<Char> Function(Pointer<OrtCustomOp> op)>>
Returns the name of the op
getter/setter pair
GetOutputCharacteristic Pointer<NativeFunction<UnsignedInt Function(Pointer<OrtCustomOp> op, Size index)>>
getter/setter pair
GetOutputType Pointer<NativeFunction<UnsignedInt Function(Pointer<OrtCustomOp> op, Size index)>>
getter/setter pair
GetOutputTypeCount Pointer<NativeFunction<Size Function(Pointer<OrtCustomOp> op)>>
getter/setter pair
GetStartVersion Pointer<NativeFunction<Int Function(Pointer<OrtCustomOp> op)>>
Get start range
getter/setter pair
GetVariadicInputHomogeneity Pointer<NativeFunction<Int Function(Pointer<OrtCustomOp> op)>>
Returns true (non-zero) if all arguments of a variadic input have to be of the same type (homogeneous), and false (zero) otherwise. Applicable only for custom ops that have a variadic input.
getter/setter pair
GetVariadicInputMinArity Pointer<NativeFunction<Int Function(Pointer<OrtCustomOp> op)>>
Returns the minimum number of input arguments expected for the variadic input. Applicable only for custom ops that have a variadic input.
getter/setter pair
GetVariadicOutputHomogeneity Pointer<NativeFunction<Int Function(Pointer<OrtCustomOp> op)>>
Returns true (non-zero) if all outputs values of a variadic output have to be of the same type (homogeneous), and false (zero) otherwise. Applicable only for custom ops that have a variadic output.
getter/setter pair
GetVariadicOutputMinArity Pointer<NativeFunction<Int Function(Pointer<OrtCustomOp> op)>>
Returns the minimum number of output values expected for the variadic output. Applicable only for custom ops that have a variadic output.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
InferOutputShapeFn Pointer<NativeFunction<OrtStatusPtr Function(Pointer<OrtCustomOp>, Pointer<OrtShapeInferContext>)>>
getter/setter pair
KernelCompute Pointer<NativeFunction<Void Function(Pointer<Void> op_kernel, Pointer<OrtKernelContext> context)>>
Perform a computation step. It is recommended to use KernelComputeV2 which allows for a safe error propagation by returning an OrtStatusPtr.
getter/setter pair
KernelComputeV2 Pointer<NativeFunction<OrtStatusPtr Function(Pointer<Void> op_kernel, Pointer<OrtKernelContext> context)>>
Perform the computation step.
getter/setter pair
KernelDestroy Pointer<NativeFunction<Void Function(Pointer<Void> op_kernel)>>
getter/setter pair
ReleaseAliasMap Pointer<NativeFunction<Void Function(Pointer<Int> input_index, Pointer<Int> output_index)>>
getter/setter pair
ReleaseMayInplace Pointer<NativeFunction<Void Function(Pointer<Int> input_index, Pointer<Int> output_index)>>
Release the pointer input_index and output_index allocated from GetMayInplace() function. If GetMayInplace() is defined, this function MUST be defined as well.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
version int
Must be initialized to ORT_API_VERSION
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited