Cumsum


tensorflow C++ API

tensorflow::ops::Cumsum

Compute the cumulative sum of the tensorxalongaxis.


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 theexclusivekwarg toTrue, an exclusive cumsum is performed instead: ```prettyprint tf.cumsum([a, b, c], exclusive=True) ==> [0, a, a + b] ```

By setting thereversekwarg 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 separatetf.reverse` ops.

Thereverseandexclusivekwargs can also be combined: ```prettyprint tf.cumsum([a, b, c], exclusive=True, reverse=True) ==> [b + c, c, 0] ```

Arguments:

Returns:

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.

Using Method

results matching ""

    No results matching ""