tensorflow :: ops :: SparseSegmentSumWithNumSegments
#include <math_ops.h>
Menghitung jumlah di sepanjang segmen renggang sebuah tensor.
Ringkasan
Seperti SparseSegmentSum
, tetapi mengizinkan id yang hilang di segment_ids
. Jika id salah, tensor output
pada posisi itu akan menjadi nol.
Baca bagian tentang segmentasi untuk penjelasan tentang segmen.
Sebagai contoh:
c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]])
tf.sparse_segment_sum_with_num_segments( c, tf.constant([0, 1]), tf.constant([0, 0]), num_segments=3) # => [[0 0 0 0] # [0 0 0 0] # [0 0 0 0]]
tf.sparse_segment_sum_with_num_segments(c, tf.constant([0, 1]), tf.constant([0, 2], num_segments=4)) # => [[ 1 2 3 4] # [ 0 0 0 0] # [-1 -2 -3 -4] # [ 0 0 0 0]]
Argumen:
- scope: Objek Scope
- indeks: Tensor 1-D. Memiliki peringkat yang sama dengan
segment_ids
. - segment_id: Tensor 1-D. Nilai harus diurutkan dan dapat diulang.
- num_segments: Harus sama dengan jumlah ID segmen yang berbeda.
Pengembalian:
-
Output
: Bentuknya sama dengan data, kecuali dimensi 0 yang ukurannyanum_segments
.
Pembuat dan Penghancur | |
---|---|
SparseSegmentSumWithNumSegments (const :: tensorflow::Scope & scope, :: tensorflow::Input data, :: tensorflow::Input indices, :: tensorflow::Input segment_ids, :: tensorflow::Input num_segments) |
Atribut publik | |
---|---|
operation | |
output |
Fungsi publik | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
Atribut publik
operasi
Operation operation
keluaran
::tensorflow::Output output
Fungsi publik
SparseSegmentSumWithNumSegments
SparseSegmentSumWithNumSegments( const ::tensorflow::Scope & scope, ::tensorflow::Input data, ::tensorflow::Input indices, ::tensorflow::Input segment_ids, ::tensorflow::Input num_segments )
simpul
::tensorflow::Node * node() const
operator :: tensorflow :: Input
operator::tensorflow::Input() const
operator :: tensorflow :: Keluaran
operator::tensorflow::Output() const