コード例 #1
0
        public void Diag_OneDimensionalArray_ThrowException()
        {
            // arrange
            var device = HostDevice.Instance;
            var input  = NdArray <int> .Arange(device, 0, 9, 1);

            // action
            var diag = NdArrayOperator <int> .Diag(input);
        }
コード例 #2
0
        public void Diag()
        {
            // arrange
            var device = HostDevice.Instance;
            var input  = NdArray <int> .Arange(device, 0, 9, 1).Reshape(new[] { 3, 3 });

            // action
            var diag = NdArrayOperator <int> .Diag(input);

            // assert
            Assert.AreEqual(0, diag[0].Value);
            Assert.AreEqual(4, diag[1].Value);
            Assert.AreEqual(8, diag[2].Value);
        }