aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Tensor/README.md
diff options
context:
space:
mode:
authorGravatar Igor Babuschkin <igor@babuschk.in>2016-06-02 13:35:47 +0100
committerGravatar Igor Babuschkin <igor@babuschk.in>2016-06-02 13:35:47 +0100
commitfbd7ed6ff73eca76aa6e0691228d26098ad9c19e (patch)
tree4f860fb483ceb58cf6cbc7f4d834f923ca50d358 /unsupported/Eigen/CXX11/src/Tensor/README.md
parent0ed08fd28180e41838fbe40f8e96c888220895ed (diff)
Add tensor scan op
This is the initial implementation a generic scan operation. Based on this, cumsum and cumprod method have been added to TensorBase.
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/README.md')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/README.md38
1 files changed, 38 insertions, 0 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/README.md b/unsupported/Eigen/CXX11/src/Tensor/README.md
index eeca2f69e..fda33edda 100644
--- a/unsupported/Eigen/CXX11/src/Tensor/README.md
+++ b/unsupported/Eigen/CXX11/src/Tensor/README.md
@@ -1168,6 +1168,44 @@ Reduce a tensor using a user-defined reduction operator. See ```SumReducer```
in TensorFunctors.h for information on how to implement a reduction operator.
+## Scan Operations
+
+A *Scan* operation returns a tensor with the same dimensions as the original
+tensor. The operation performs an inclusive scan along the specified
+axis, which means it computes a running total along the axis for a given
+reduction operation.
+If the reduction operation corresponds to summation, then this computes the
+prefix sum of the tensor along the given axis.
+
+Example:
+dd a comment to this line
+
+ // Create a tensor of 2 dimensions
+ Eigen::Tensor<int, 2> a(2, 3);
+ a.setValues({{1, 2, 3}, {4, 5, 6}});
+ // Scan it along the second dimension (1) using summation
+ Eigen::Tensor<int, 2> b = a.cumsum(1);
+ // The result is a tensor with the same size as the input
+ cout << "a" << endl << a << endl << endl;
+ cout << "b" << endl << b << endl << endl;
+ =>
+ a
+ 1 2 3
+ 6 5 4
+
+ b
+ 1 3 6
+ 4 9 15
+
+### <Operation> cumsum(const Index& axis)
+
+Perform a scan by summing consecutive entries.
+
+### <Operation> cumprod(const Index& axis)
+
+Perform a scan by multiplying consecutive entries.
+
+
## Convolutions
### <Operation> convolve(const Kernel& kernel, const Dimensions& dims)