dòng chảy căng:: ôi:: Phân đoạn thưa thớtSumWithNumSegments

#include <math_ops.h>

Tính tổng dọc theo các đoạn thưa thớt của một tensor.

Bản tóm tắt

Giống như SparseSegmentSum nhưng cho phép thiếu id trong segment_ids . Nếu một id bị sai thì tensor output ở vị trí đó sẽ bằng 0.

Đọc phần về phân đoạn để biết giải thích về các phân đoạn.

Ví dụ:

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]]

Tranh luận:

  • phạm vi: Một đối tượng Phạm vi
  • chỉ số: Một tensor 1-D. Có cùng thứ hạng với segment_ids .
  • Seg_ids: Tenxơ 1-D. Các giá trị phải được sắp xếp và có thể lặp lại.
  • num_segments: Phải bằng số ID phân đoạn riêng biệt.

Trả về:

  • Output : Có hình dạng giống như dữ liệu, ngoại trừ thứ nguyên 0 có kích thước num_segments .

Hàm tạo và hàm hủy

SparseSegmentSumWithNumSegments (const :: tensorflow::Scope & scope, :: tensorflow::Input data, :: tensorflow::Input indices, :: tensorflow::Input segment_ids, :: tensorflow::Input num_segments)

Thuộc tính công khai

operation
output

Chức năng công cộng

node () const
::tensorflow::Node *
operator::tensorflow::Input () const
operator::tensorflow::Output () const

Thuộc tính công khai

hoạt động

Operation operation

đầu ra

::tensorflow::Output output

Chức năng công cộng

Phân đoạn thưa thớtSumWithNumSegments

 SparseSegmentSumWithNumSegments(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input data,
  ::tensorflow::Input indices,
  ::tensorflow::Input segment_ids,
  ::tensorflow::Input num_segments
)

nút

::tensorflow::Node * node() const 

toán tử::tenorflow::Đầu vào

 operator::tensorflow::Input() const 

toán tử::tenorflow::Đầu ra

 operator::tensorflow::Output() const