예제 #1
0
        public void CopyToRows()
        {
            float[] test = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            Tensor.NewZeroed(3, 10, out Tensor tensor);
            Gpu gpu = Gpu.Default;

            using (DeviceMemory <float> m_gpu = gpu.AllocateDevice(test))
            {
                m_gpu.CopyTo(tensor, 5, 3);
            }
            float[,] expected =
            {
                { 0, 0, 0, 0, 0, 1, 2, 3, 0, 0 },
                { 0, 0, 0, 0, 0, 4, 5, 6, 0, 0 },
                { 0, 0, 0, 0, 0, 7, 8, 9, 0, 0 }
            };
            Assert.IsTrue(tensor.ToArray2D().ContentEquals(expected));
        }