Cumsum
tensorflow C++ API
Compute the cumulative sum of the tensorx
alongaxis
.
Summary
By default, this op performs an inclusive cumsum, which means that the first element of the input is identical to the first element of the output: ```prettyprint tf.cumsum([a, b, c]) ==> [a, a + b, a + b + c] ```
By setting theexclusive
kwarg toTrue
, an exclusive cumsum is performed instead: ```prettyprint tf.cumsum([a, b, c], exclusive=True) ==> [0, a, a + b] ```
By setting thereverse
kwarg toTrue
, the cumsum is performed in the opposite direction: ```prettyprint tf.cumsum([a, b, c], reverse=True) ==> [a + b + c, b + c, c] ``This is more efficient than using separate
tf.reverse` ops.
Thereverse
andexclusive
kwargs can also be combined: ```prettyprint tf.cumsum([a, b, c], exclusive=True, reverse=True) ==> [b + c, c, 0] ```
Arguments:
- scope: A Scope object
Returns:
Output
: The out tensor.
Constructor
- Cumsum(const ::tensorflow::Scope & scope, ::tensorflow::Input x, ::tensorflow::Input axis, const Cumprod::Attrs & attrs).
Public attributes
- tensorflow::Output out.
Cumsum block
Source link : https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_math.cpp
Argument:
- Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.).
- Input x:connect Input node.
- Input axis:connect Input node. ex) 0 or 1.
- Cumsum ::Attrs attrs:Input attrs in value. ex) exclusive_ = false_; reverse__ =false;
Return:
- Output out: Output object of Cumsum class object.
Result:
- std::vector(Tensor) product_result : Returned object of executed result by calling session.