The input to the reduction.
The axes the reduction should be performed along.
The resulting operation.
1 import dopt.core : evaluate; 2 3 auto s1 = float32([2], [0.5, 1.5]).sum(); 4 auto s2 = float32([2, 2], [0, 1, 0, 5]).sum(); 5 auto s3 = float32([2, 2], [0, 1, 0, 5]).sum([0]); 6 auto s4 = float32([2, 2], [0, 1, 0, 5]).sum([1]); 7 8 assert(s1.evaluate().as!float == [2.0f]); 9 assert(s2.evaluate().as!float == [6.0f]); 10 assert(s3.evaluate().as!float == [0.0f, 6.0f]); 11 assert(s4.evaluate().as!float == [1.0f, 5.0f]);
Computes a sum reduction along the specified axes.