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

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

            // action
            var trace = ReductionFunction <int> .Trace(input);

            // assert
            Assert.AreEqual(12, trace[0].Value);
            Assert.AreEqual(39, trace[1].Value);
            Assert.AreEqual(66, trace[2].Value);
        }