コード例 #1
0
        public void cntk_zeros()
        {
            using (var K = new CNTKBackend())
            {
                #region doc_zeros
                var kvar = K.zeros(new int[] { 3, 4 });
                var a    = K.eval(kvar); // new[,] {{ 0.,  0.,  0.,  0.},
                                         //         { 0.,  0.,  0.,  0.},
                                         //         { 0.,  0.,  0.,  0.}}
                #endregion

                float[,] actual = (float[, ])a;
                Assert.AreEqual(3, actual.Rows());
                Assert.AreEqual(4, actual.Columns());

                double[,] expected = new[, ] {
                    { 0.0, 0.0, 0.0, 0.0 },
                    { 0.0, 0.0, 0.0, 0.0 },
                    { 0.0, 0.0, 0.0, 0.0 }
                };

                Assert.AreEqual(expected, actual);
            }
        }