Beispiel #1
0
        public void ExplicitDisposal()
        {
            // Allocate many 256MB tensors. Without explicit disposal memory use relies on finalization.
            // This will often succeed but not reliably
            int n = 25;

            for (int i = 0; i < n; i++)
            {
                Console.WriteLine("ExplicitDisposal: Loop iteration {0}", i);

                using (var x = FloatTensor.Empty(new long[] { 64000, 1000 }, deviceType: DeviceType.CPU)) { }
            }
            Console.WriteLine("Hello World!");
        }