tensorflow::ops::SparseSegmentSumWithNumSegments

#include <math_ops.h>

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

Bản tóm tắt

Tương tự như SparseSegmentSum , nhưng cho phép các ID bị thiếu trong segment_ids . Nếu thiếu một ID, tensor output tại vị trí đó sẽ được đặt về 0.

Hãy đọc phần về phân khúc thị trường để hiểu rõ hơn về khái niệm phân khúc.

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

Luận điểm:

  • phạm vi: Một đối tượng Phạm vi
  • indices: Một tensor 1 chiều. Có cùng hạng với segment_ids .
  • segment_ids: Một tensor 1 chiều. Các giá trị nên được sắp xếp và có thể lặp lại.
  • num_segments: Phải bằng số lượng ID phân đoạn khác nhau.

Trả về:

  • Output : Có cùng hình dạng với dữ liệu, ngoại trừ chiều 0 có kích thước là num_segments .

Hàm khởi 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

SparseSegmentSumWithNumSegments

 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 

operator::tensorflow::Input

 operator::tensorflow::Input() const 

operator::tensorflow::Output

 operator::tensorflow::Output() const