Exemplo n.º 1
0
        public void cntk_ndim_test()
        {
            // https://github.com/fchollet/keras/blob/f65a56fb65062c8d14d215c9f4b1015b97cc5bf3/keras/backend/tensorflow_backend.py#L508
            using (var K = new CNTKBackend())
            {
                #region doc_ndim
                var input = K.placeholder(shape: new int?[] { 2, 4, 5 });
                double[,] val = new double[, ] {
                    { 1, 2 }, { 3, 4 }
                };
                var kvar = K.variable(array: (Array)val);
                int?a    = K.ndim(input); // 3
                int?b    = K.ndim(kvar);  // 2
                #endregion

                Assert.AreEqual(3, a);
                Assert.AreEqual(2, b);
            }
        }