Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::ops::SparseReduceSumSparse
#include <sparse_ops.h>
Computes the sum of elements across dimensions of a SparseTensor.
Summary
This Op takes a SparseTensor and is the sparse counterpart to tf.reduce_sum()
. In contrast to SparseReduceSum, this Op returns a SparseTensor.
Reduces sp_input
along the dimensions given in reduction_axes
. Unless keep_dims
is true, the rank of the tensor is reduced by 1 for each entry in reduction_axes
. If keep_dims
is true, the reduced dimensions are retained with length 1.
If reduction_axes
has no entries, all dimensions are reduced, and a tensor with a single element is returned. Additionally, the axes can be negative, which are interpreted according to the indexing rules in Python.
Args:
- scope: A Scope object
- input_indices: 2-D.
N x R
matrix with the indices of non-empty values in a SparseTensor, possibly not in canonical ordering.
- input_values: 1-D.
N
non-empty values corresponding to input_indices
.
- input_shape: 1-D. Shape of the input SparseTensor.
- reduction_axes: 1-D. Length-
K
vector containing the reduction axes.
Optional attributes (see Attrs
):
- keep_dims: If true, retain reduced dimensions with length 1.
Returns:
Public static functions
|
KeepDims(bool x)
|
|
Public attributes
Public functions
Public static functions
KeepDims
Attrs KeepDims(
bool x
)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2021-11-15 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2021-11-15 UTC."],[],[],null,["# tensorflow::ops::SparseReduceSumSparse Class Reference\n\ntensorflow::ops::SparseReduceSumSparse\n======================================\n\n`#include \u003csparse_ops.h\u003e`\n\nComputes the sum of elements across dimensions of a SparseTensor.\n\nSummary\n-------\n\nThis Op takes a SparseTensor and is the sparse counterpart to `tf.reduce_sum()`. In contrast to [SparseReduceSum](/api_docs/cc/class/tensorflow/ops/sparse-reduce-sum#classtensorflow_1_1ops_1_1_sparse_reduce_sum), this Op returns a SparseTensor.\n\nReduces `sp_input` along the dimensions given in `reduction_axes`. Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained with length 1.\n\nIf `reduction_axes` has no entries, all dimensions are reduced, and a tensor with a single element is returned. Additionally, the axes can be negative, which are interpreted according to the indexing rules in Python.\n\nArgs:\n\n- scope: A [Scope](/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input_indices: 2-D. `N x R` matrix with the indices of non-empty values in a SparseTensor, possibly not in canonical ordering.\n- input_values: 1-D. `N` non-empty values corresponding to `input_indices`.\n- input_shape: 1-D. Shape of the input SparseTensor.\n- reduction_axes: 1-D. Length-`K` vector containing the reduction axes.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/api_docs/cc/struct/tensorflow/ops/sparse-reduce-sum-sparse/attrs#structtensorflow_1_1ops_1_1_sparse_reduce_sum_sparse_1_1_attrs)):\n\n- keep_dims: If true, retain reduced dimensions with length 1.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output_indices\n- [Output](/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output_values\n- [Output](/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output_shape\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [SparseReduceSumSparse](#classtensorflow_1_1ops_1_1_sparse_reduce_sum_sparse_1a6f708aa542de1f8a78354e33cd93ba1f)`(const ::`[tensorflow::Scope](/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_indices, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_values, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_shape, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` reduction_axes)` ||\n| [SparseReduceSumSparse](#classtensorflow_1_1ops_1_1_sparse_reduce_sum_sparse_1a3993e307a94ec2d2689f821a60717e99)`(const ::`[tensorflow::Scope](/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_indices, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_values, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_shape, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` reduction_axes, const `[SparseReduceSumSparse::Attrs](/api_docs/cc/struct/tensorflow/ops/sparse-reduce-sum-sparse/attrs#structtensorflow_1_1ops_1_1_sparse_reduce_sum_sparse_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|-----------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_sparse_reduce_sum_sparse_1a163cffc8414946a47057a91af8be0e12) | [Operation](/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output_indices](#classtensorflow_1_1ops_1_1_sparse_reduce_sum_sparse_1a2c546e86ac344ff2cc261c06aac187f4) | `::`[tensorflow::Output](/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [output_shape](#classtensorflow_1_1ops_1_1_sparse_reduce_sum_sparse_1ad3c4282b03471d1e02bba7e17a46fca6) | `::`[tensorflow::Output](/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [output_values](#classtensorflow_1_1ops_1_1_sparse_reduce_sum_sparse_1a19b2438eeddfcd3e79017ecb5de54318) | `::`[tensorflow::Output](/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public static functions ||\n|---------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|\n| [KeepDims](#classtensorflow_1_1ops_1_1_sparse_reduce_sum_sparse_1a8dbe087349a7dd3db345a7abd6752c3d)`(bool x)` | [Attrs](/api_docs/cc/struct/tensorflow/ops/sparse-reduce-sum-sparse/attrs#structtensorflow_1_1ops_1_1_sparse_reduce_sum_sparse_1_1_attrs) |\n\n| ### Structs ||\n|--------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::SparseReduceSumSparse::Attrs](/api_docs/cc/struct/tensorflow/ops/sparse-reduce-sum-sparse/attrs) | Optional attribute setters for [SparseReduceSumSparse](/api_docs/cc/class/tensorflow/ops/sparse-reduce-sum-sparse#classtensorflow_1_1ops_1_1_sparse_reduce_sum_sparse). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output_indices\n\n```scdoc\n::tensorflow::Output output_indices\n``` \n\n### output_shape\n\n```scdoc\n::tensorflow::Output output_shape\n``` \n\n### output_values\n\n```scdoc\n::tensorflow::Output output_values\n``` \n\nPublic functions\n----------------\n\n### SparseReduceSumSparse\n\n```gdscript\n SparseReduceSumSparse(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input_indices,\n ::tensorflow::Input input_values,\n ::tensorflow::Input input_shape,\n ::tensorflow::Input reduction_axes\n)\n``` \n\n### SparseReduceSumSparse\n\n```gdscript\n SparseReduceSumSparse(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input_indices,\n ::tensorflow::Input input_values,\n ::tensorflow::Input input_shape,\n ::tensorflow::Input reduction_axes,\n const SparseReduceSumSparse::Attrs & attrs\n)\n``` \n\nPublic static functions\n-----------------------\n\n### KeepDims\n\n```text\nAttrs KeepDims(\n bool x\n)\n```"]]