tensorflow::ops::Cumsum
#include <math_ops.h>
Вычислить кумулятивную сумму тензора x вдоль axis.
Summary
По умолчанию, этот оператор выполняет включительную кумулятивную сумму, что означает, что первый элемент входного значения идентичен первому элементу выходного значения:
tf.cumsum([a, b, c]) # => [a, a + b, a + b + c]
Установив параметр exclusive в True, выполняется исключительная кумулятивная сумма:
tf.cumsum([a, b, c], exclusive=True) # => [0, a, a + b]
Установив параметр reverse в True, кумулятивная сумма выполняется в обратном направлении:
tf.cumsum([a, b, c], reverse=True) # => [a + b + c, b + c, c]
Это более эффективно, чем использование отдельных tf.reverse операторов.
Параметры reverse и exclusive также могут быть объединены:
tf.cumsum([a, b, c], exclusive=True, reverse=True) # => [b + c, c, 0]
Аргументы:
- scope: Объект Scope
- x: A
Tensor. Должен быть одного из следующих типов:float32,float64,int64,int32,uint8,uint16,int16,int8,complex64,complex128,qint8,quint8,qint32,half. - axis: A
Tensorтипаint32(по умолчанию: 0). Должен находиться в диапазоне[-rank(x), rank(x)).
Необязательные атрибуты (см. Attrs):
- exclusive: Если
True, выполнить исключительную кумулятивную сумму. - reverse: A
bool(по умолчанию: False).
Возвращает:
-
Output: Тензор результата.
| Конструкторы и деструкторы | |
|---|---|
Cumsum(const ::tensorflow::Scope & scope, ::tensorflow::Input x, ::tensorflow::Input axis) | |
Cumsum(const ::tensorflow::Scope & scope, ::tensorflow::Input x, ::tensorflow::Input axis, const Cumsum::Attrs & attrs) |
| Публичные атрибуты | |
|---|---|
operation | |
out | |
| Публичные функции | |
|---|---|
node() const | ::tensorflow::Node * |
operator::tensorflow::Input() const | |
operator::tensorflow::Output() const | |
| Публичные статические функции | |
|---|---|
Exclusive(bool x) | |
Reverse(bool x) | |
| Структуры | |
|---|---|
| tensorflow::ops::Cumsum::Attrs | Необязательные устанавливатели атрибутов для Cumsum. |
Публичные атрибуты
operation
Operation operation
out
::tensorflow::Output out
Публичные функции
Cumsum
Cumsum( const ::tensorflow::Scope & scope, ::tensorflow::Input x, ::tensorflow::Input axis )
Cumsum
Cumsum( const ::tensorflow::Scope & scope, ::tensorflow::Input x, ::tensorflow::Input axis, const Cumsum::Attrs & attrs )
node
::tensorflow::Node * node() const
operator::tensorflow::Input
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
Публичные статические функции
Exclusive
Attrs Exclusive( bool x )
Reverse
Attrs Reverse( bool x )
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/cc/class/tensorflow/ops/cumsum