diff options
Diffstat (limited to 'tensorflow/core/api_def/base_api/api_def_SparseSegmentSumWithNumSegments.pbtxt')
-rw-r--r-- | tensorflow/core/api_def/base_api/api_def_SparseSegmentSumWithNumSegments.pbtxt | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tensorflow/core/api_def/base_api/api_def_SparseSegmentSumWithNumSegments.pbtxt b/tensorflow/core/api_def/base_api/api_def_SparseSegmentSumWithNumSegments.pbtxt new file mode 100644 index 0000000000..3aeaba38e9 --- /dev/null +++ b/tensorflow/core/api_def/base_api/api_def_SparseSegmentSumWithNumSegments.pbtxt @@ -0,0 +1,57 @@ +op { + graph_op_name: "SparseSegmentSumWithNumSegments" + in_arg { + name: "indices" + description: <<END +A 1-D tensor. Has same rank as `segment_ids`. +END + } + in_arg { + name: "segment_ids" + description: <<END +A 1-D tensor. Values should be sorted and can be repeated. +END + } + in_arg { + name: "num_segments" + description: <<END +Should equal the number of distinct segment IDs. +END + } + out_arg { + name: "output" + description: <<END +Has same shape as data, except for dimension 0 which +has size `num_segments`. +END + } + summary: "Computes the sum along sparse segments of a tensor." + description: <<END +Like `SparseSegmentSum`, but allows missing ids in `segment_ids`. If an id is +misisng, the `output` tensor at that position will be zeroed. + +Read @{$math_ops#segmentation$the section on segmentation} for an explanation of +segments. + +For example: + +```python +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]] +``` +END +} |