예제 #1
0
        private static NativeMemoryAllocatorInfo CreateCpuAllocatorInfo()
        {
            IntPtr allocInfo = IntPtr.Zero;

            try
            {
                IntPtr status = NativeMethods.ONNXRuntimeCreateCpuAllocatorInfo(NativeMethods.AllocatorType.DeviceAllocator, NativeMethods.MemoryType.Cpu, out allocInfo);
                NativeApiStatus.VerifySuccess(status);
            }
            catch (Exception e)
            {
                if (allocInfo != IntPtr.Zero)
                {
                    Delete(allocInfo);
                }
                throw e;
            }
            return(new NativeMemoryAllocatorInfo(allocInfo));
        }