mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-20 21:40:57 +00:00
28 lines
602 B
C#
28 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;
|
|
}
|
|
}
|
|
}
|