예제 #1
0
        public void ReShape_UnknownDimension()
        {
            var volume = new Double.Volume(new[] { 1.0, 2.0, 3.0 }, new Shape(3), GpuContext.Default);

            var reshaped = volume.ReShape(1, -1);

            Assert.AreEqual(reshaped.Shape.TotalLength, 3);
        }
        public void ReShape_Data()
        {
            var data   = new[] { 1.0, 2.0, 3.0 };
            var volume = new Double.Volume(data, new Shape(3), GpuContext.Default);

            var reshaped = volume.ReShape(1, -1);

            Assert.IsTrue(reshaped.ToArray().SequenceEqual(volume.Storage.ToArray()));
        }
예제 #3
0
        public void ReShapeKeep()
        {
            var volume = new Double.Volume(new[]
            {
                1.0, 2.0,
                3.0, 4.0,

                5.0, 6.0,
                7.0, 8.0,

                9.0, 10.0,
                11.0, 12.0,
            }, new Shape(2, 2, 1, 3));

            var reshaped = volume.ReShape(1, 1, Shape.None, Shape.Keep);

            Assert.AreEqual(reshaped.Shape.DimensionCount, 4);
            Assert.AreEqual(reshaped.Shape.TotalLength, 12);
            Assert.AreEqual(new Shape(1, 1, 4, 3), reshaped.Shape);
        }
        public void ReShape_WrongDimension()
        {
            var volume = new Double.Volume(new[] { 1.0, 2.0, 3.0 }, new Shape(3), GpuContext.Default);

            volume.ReShape(1, 4);
        }
예제 #5
0
        public void ReShape_WrongDimension()
        {
            var volume = new Double.Volume(new[] { 1.0, 2.0, 3.0 }, new Shape(3), GpuContext.Default);

            Assert.Throws <ArgumentException>(() => volume.ReShape(1, 4));
        }
예제 #6
0
        public void ReShape_WrongDimension()
        {
            var volume = new Double.Volume(new[] { 1.0, 2.0, 3.0 }, new Shape(3));

            volume.ReShape(1, 4);
        }