示例#1
0
        public void ITest()
        {
            var t     = TensorOld.I(10);
            var shape = t.Shape;

            Assert.Equal(2, t.Rank);
            Assert.Equal(100, t.ElementCount);
            Assert.Equal(10, shape[0]);
            Assert.Equal(10, shape[1]);

            for (int i = 0; i < shape[0]; i++)
            {
                for (int j = 0; j < shape[1]; j++)
                {
                    if (i == j)
                    {
                        Assert.Equal(1, t[i, j]);
                    }
                    else
                    {
                        Assert.Equal(0, t[i, j]);
                    }
                }
            }
        }