Esempio n. 1
0
        /// <summary>
        /// Computes and displays t = t + 1
        /// </summary>
        public static void Example3()
        {
            var cns = new ConvNetSharp <float>();

            // Graph creation
            var t   = cns.PlaceHolder("t");
            var fun = cns.Assign(t, t + 1);

            using (var session = new Session <float>())
            {
                session.InitializePlaceHolders(fun, new Dictionary <string, Volume <float> > {
                    { "t", 1.0f }
                });

                do
                {
                    session.Run(fun, null);

                    var x = t.Result.Get(0);
                    Console.WriteLine(x);
                } while (!Console.KeyAvailable);

                // Display graph
                var vm  = new ViewModel <float>(fun);
                var app = new Application();
                app.Run(new GraphControl {
                    DataContext = vm
                });
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Computes and displays t = t + 1
        /// </summary>
        public static void Example3()
        {
            var cns = new ConvNetSharp <float>();

            BuilderInstance <float> .Volume = new VolumeBuilder();

            // Graph creation
            var t   = cns.Variable(0.0f, "t", true);
            var fun = cns.Assign(t, t + 1.0f);

            using (var session = new Session <float>())
            {
                session.InitializePlaceHolders(fun, new Dictionary <string, Volume <float> > {
                    { "t", 1.0f }
                });

                do
                {
                    session.Run(fun, null);

                    var x = t.Result.Get(0);
                    Console.WriteLine(x);
                } while (!Console.KeyAvailable);
            }
        }