Exemple #1
0
        public void TestDataCombineAxis2()
        {
            var a = DataSourceFactory.Create(new float[] { 11, 12, 13, 14, 15, 16, 17, 18 }, new int[] { 2, 2, 2 });
            var b = DataSourceFactory.Create(new float[] { 21, 22, 23, 24, 25, 26, 27, 28, 29, 20, 21, 22 }, new int[] { 2, 2, 3 });

            var result = DataSourceFactory.Combine(new IDataSource <float>[] { a, b }, 2);

            var newShape = new int[] { 2, 2, 5 };
            var newData  = new float[] {
                11, 12, 13, 14, 15, 16, 17, 18,
                21, 22, 23, 24, 25, 26, 27, 28, 29, 20, 21, 22
            };

            CollectionAssert.AreEqual(newShape, result.Shape.Dimensions);
            CollectionAssert.AreEqual(newData, (float[])result.Data);
        }
Exemple #2
0
        public void TestDataCombineAxis1()
        {
            var a = DataSourceFactory.Create(new float[] { 11, 12, 13, 14 }, new int[] { 2, 2, 1 });
            var b = DataSourceFactory.Create(new float[] { 21, 22, 23, 24, 25, 26 }, new int[] { 2, 3, 1 });

            var result = DataSourceFactory.Combine(new IDataSource <float>[] { a, b }, 1);

            var newShape = new int[] { 2, 5, 1 };
            var newData  = new float[] {
                11, 12, 13, 14,
                21, 22, 23, 24, 25, 26
            };

            CollectionAssert.AreEqual(newShape, result.Shape.Dimensions);
            CollectionAssert.AreEqual(newData, (float[])result.Data);
        }