Ejemplo n.º 1
0
 public static string GenerateNetworkGraph(Function model)
 {
     try
     {
         var fg     = new NetToGraph();
         var dotStr = fg.ToGraph(model);
         return(dotStr);
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 2
0
        private static void cntkModelToGraphviz1()
        {
            var net = new FeedForwaredNN(DeviceDescriptor.UseDefaultDevice(), DataType.Float);

            //define input and output variable and connecting to the stream configuration
            var feature = Variable.InputVariable(new NDShape(1, 4), DataType.Float, "features");
            var label   = Variable.InputVariable(new NDShape(1, 3), DataType.Float, "flower");
            //firs hidden layer
            var model = net.Dense(feature, 5, Activation.ReLU, "hidden");

            model = net.Dense(model, 3, Activation.Softmax, "flower");

            NetToGraph fg = new NetToGraph();

            var dot = fg.ToGraph(model);

            // Save it to a file
            File.WriteAllText("myFile.dot", dot);
        }