Ejemplo n.º 1
0
        private static NativeMemoryAllocator CreateDefaultCpuAllocator()
        {
            IntPtr allocator = IntPtr.Zero;

            try
            {
                IntPtr status = NativeMethods.ONNXRuntimeCreateDefaultAllocator(out allocator);
                NativeApiStatus.VerifySuccess(status);
            }
            catch (Exception e)
            {
                if (allocator != IntPtr.Zero)
                {
                    Delete(allocator);
                }
                throw e;
            }

            return(new NativeMemoryAllocator(allocator));
        }