mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-31 23:27:43 +00:00
29 lines
602 B
C#
29 lines
602 B
C#
|
|
using System;
|
|||
|
|
using System.Runtime.InteropServices;
|
|||
|
|
|
|||
|
|
namespace Microsoft.ML.OnnxRuntime
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
internal class NativeOnnxObjectHandle : SafeHandle
|
|||
|
|
{
|
|||
|
|
public NativeOnnxObjectHandle(IntPtr ptr)
|
|||
|
|
: base(IntPtr.Zero, true)
|
|||
|
|
{
|
|||
|
|
handle = ptr;
|
|||
|
|
}
|
|||
|
|
public override bool IsInvalid
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
return (handle == IntPtr.Zero);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected override bool ReleaseHandle()
|
|||
|
|
{
|
|||
|
|
NativeMethods.ONNXRuntimeReleaseObject(handle);
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|