예제 #1
0
        static void Main(string[] args)
        {
            // boot .net core 10.5M.
            var mm = new MemoryMonitor();

            // warm up tensorflow.net 28.5M.
            mm.WarmUp();
            var cases = new MemoryTestingCases();

            int batchSize = 1000;

            // explaination of constant
            mm.Execute(10, 100 * batchSize, cases.Constant2x3);

            // 1 million float tensor 68M.
            mm.Execute(10, 100 * batchSize, cases.Constant);

            // 100K float variable 84M.
            mm.Execute(10, 10 * batchSize, cases.Variable);

            // 1 million math add 39M.
            mm.Execute(10, 100 * batchSize, cases.MathAdd);

            // 100K gradient 44M.
            mm.Execute(10, 10 * batchSize, cases.Gradient);

            // 95M
            Console.WriteLine("Finished.");
            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            var diag = new Diagnostician();
            // diag.Diagnose(@"D:\memory.txt");

            // this class is used explor new features.
            var exploring = new Exploring();
            // exploring.Run();

            // boot .net core 10.5M.
            var mm = new MemoryMonitor();

            // warm up tensorflow.net 37.3M.
            mm.WarmUp();

            BasicTest(mm);

            KerasTest(mm);

            FuncGraph(mm);

            // 65M
            Console.WriteLine("Finished.");
            Console.ReadLine();
        }
예제 #3
0
        static void KerasTest(MemoryMonitor mm)
        {
            var keras = new MemoryKerasTest();

            // +1M (10,50)
            mm.Execute(10, 1, keras.Conv2DLayer);

            mm.Execute(10, 50, keras.InputLayer);

            mm.Execute(10, 10, keras.Prediction);
        }
예제 #4
0
        static void BasicTest(MemoryMonitor mm)
        {
            int batchSize = 1000;

            var basic = new MemoryBasicTest();

            // 1 million placeholder

            /*tf.compat.v1.disable_eager_execution();
             * mm.Execute(10, 100 * batchSize, basic.Placeholder);
             * tf.enable_eager_execution();*/

            // 1 million tensor
            mm.Execute(10, 100 * batchSize, basic.Constant);

            // explaination of constant
            mm.Execute(10, 100 * batchSize, basic.Constant2x3);

            mm.Execute(10, 100 * batchSize, basic.ConstantString);

            // 100K float variable.
            mm.Execute(10, batchSize, basic.Variable);

            mm.Execute(10, batchSize, basic.VariableRead);

            mm.Execute(10, batchSize, basic.VariableAssign);

            // 1 million math.
            mm.Execute(10, 100 * batchSize, basic.MathAdd);

            // Conv2d in constant tensor
            mm.Execute(10, batchSize, basic.Conv2DWithTensor);

            // Conv2d in variable
            mm.Execute(10, batchSize, basic.Conv2DWithVariable);

            // 100K gradient 44M.
            mm.Execute(10, 10 * batchSize, basic.Gradient);

            // memory leak when increasing the epoch
            mm.Execute(10, 10, basic.Dataset);
        }
예제 #5
0
        static void Main(string[] args)
        {
            // this class is used explor new features.
            var exploring = new Exploring();
            // exploring.Run();

            // boot .net core 10.5M.
            var mm = new MemoryMonitor();

            // warm up tensorflow.net 37.3M.
            mm.WarmUp();
            var cases = new MemoryTestingCases();

            int batchSize = 1000;

            // 1 million tensor
            mm.Execute(10, 100 * batchSize, cases.Constant);

            // explaination of constant
            mm.Execute(10, 100 * batchSize, cases.Constant2x3);

            // +0M
            mm.Execute(10, batchSize, cases.Conv2dWithTensor);

            // 100K float variable 84M.
            mm.Execute(10, batchSize, cases.Variable);

            // +45M memory leak
            mm.Execute(10, batchSize, cases.Conv2dWithVariable);

            // 1 million math add 39M.
            mm.Execute(10, 100 * batchSize, cases.MathAdd);

            // 100K gradient 44M.
            mm.Execute(10, 10 * batchSize, cases.Gradient);

            // 95M
            Console.WriteLine("Finished.");
            Console.ReadLine();
        }
예제 #6
0
        static void FuncGraph(MemoryMonitor mm)
        {
            var func = new MemoryFuncGraphTest();

            mm.Execute(10, 100, func.ConcreteFunction);
        }