using System;using static Tensorflow.Binding;namespace Tensorflow{class Program{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);// 65MConsole.WriteLine("Finished.");Console.ReadLine();}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 tensormm.Execute(10, 100 * batchSize, basic.Constant);// explaination of constantmm.Execute(10, 100 * batchSize, basic.Constant2x3);mm.Execute(10, 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 tensormm.Execute(10, batchSize, basic.Conv2DWithTensor);// Conv2d in variablemm.Execute(10, batchSize, basic.Conv2DWithVariable);// 100K gradient 44M.mm.Execute(10, 10 * batchSize, basic.Gradient);// memory leak when increasing the epochmm.Execute(10, 10, basic.Dataset);}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);}static void FuncGraph(MemoryMonitor mm){var func = new MemoryFuncGraphTest();mm.Execute(10, 100, func.ConcreteFunction);}}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。