aliran tensor:: operasi:: Cumsum
#include <math_ops.h> Hitung jumlah kumulatif tensor x sepanjang axis .
Ringkasan
Secara default, operasi ini menjalankan cumsum inklusif, yang berarti elemen pertama masukan identik dengan elemen pertama keluaran:
tf.cumsum([a, b, c]) # => [a, a + b, a + b + c]
Dengan menyetel kwarg exclusive ke True , cumsum eksklusif akan dilakukan:
tf.cumsum([a, b, c], exclusive=True) # => [0, a, a + b]
Dengan mengatur kwarg reverse ke True , cumsum dilakukan dalam arah yang berlawanan:
tf.cumsum([a, b, c], reverse=True) # => [a + b + c, b + c, c]
Ini lebih efisien daripada menggunakan operasi tf.reverse terpisah.
Kwarg reverse dan exclusive juga dapat digabungkan:
tf.cumsum([a, b, c], exclusive=True, reverse=True) # => [b + c, c, 0]
Argumen:
- ruang lingkup: Objek Lingkup
- x:
Tensor. Harus berupa salah satu dari jenis berikut:float32,float64,int64,int32,uint8,uint16,int16,int8,complex64,complex128,qint8,quint8,qint32,half. - axis:
Tensorbertipeint32(default: 0). Harus berada dalam rentang[-rank(x), rank(x)).
Atribut opsional (lihat Attrs ):
- eksklusif: Jika
True, lakukan cumsum eksklusif. - terbalik:
bool(default: False).
Pengembalian:
-
Output: Tensor keluar.
Konstruktor dan Destruktor | |
|---|---|
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) |
Atribut publik | |
|---|---|
operation | |
out | |
Fungsi publik | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
Fungsi statis publik | |
|---|---|
Exclusive (bool x) | |
Reverse (bool x) | |
Struktur | |
|---|---|
| tensorflow:: ops:: Cumsum:: Attrs | Penyetel atribut opsional untuk Cumsum . |
Atribut publik
operasi
Operation operation
keluar
::tensorflow::Output out
Fungsi publik
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 )
simpul
::tensorflow::Node * node() const
operator::tensorflow::Masukan
operator::tensorflow::Input() const
operator::tensorflow::Keluaran
operator::tensorflow::Output() const
Fungsi statis publik
Eksklusif
Attrs Exclusive( bool x )
Balik
Attrs Reverse( bool x )