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-05-14 UTC.
[null,null,["Last updated 2021-05-14 UTC."],[],[],null,["# tensorflow::ops::SparseReduceSumSparse Class Reference\n\ntensorflow::\nops::\nSparseReduceSumSparse\n========================================\n\n`\n#include \u003csparse_ops.h\u003e\n`\n\n\nComputes the sum of elements across dimensions of a SparseTensor.\n\nSummary\n-------\n\n\nThis Op takes a SparseTensor and is the sparse counterpart to\n`\ntf.reduce_sum()\n`\n. In contrast to\n[SparseReduceSum](/versions/r2.5/api_docs/cc/class/tensorflow/ops/sparse-reduce-sum#classtensorflow_1_1ops_1_1_sparse_reduce_sum)\n, this Op returns a SparseTensor.\n\n\nReduces\n`\nsp_input\n`\nalong the dimensions given in\n`\nreduction_axes\n`\n. Unless\n`\nkeep_dims\n`\nis true, the rank of the tensor is reduced by 1 for each entry in\n`\nreduction_axes\n`\n. If\n`\nkeep_dims\n`\nis true, the reduced dimensions are retained with length 1.\n\n\nIf\n`\nreduction_axes\n`\nhas 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\n\nArgs:\n\n- scope: A [Scope](/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input_indices: 2-D. `\n N x R\n ` matrix with the indices of non-empty values in a SparseTensor, possibly not in canonical ordering.\n- input_values: 1-D. `\n N\n ` non-empty values corresponding to `\n input_indices\n ` .\n- input_shape: 1-D. Shape of the input SparseTensor.\n- reduction_axes: 1-D. Length- `\n K\n ` vector containing the reduction axes.\n\n\u003cbr /\u003e\n\n\nOptional attributes (see\n`\n`[Attrs](/versions/r2.5/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):\n\n- keep_dims: If true, retain reduced dimensions with length 1.\n\n\u003cbr /\u003e\n\n\nReturns:\n\n- `\n `[Output](/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)`\n ` output_indices\n- `\n `[Output](/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)`\n ` output_values\n- `\n `[Output](/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)`\n ` 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](/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, :: `[tensorflow::Input](/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_indices, :: `[tensorflow::Input](/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_values, :: `[tensorflow::Input](/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_shape, :: `[tensorflow::Input](/versions/r2.5/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](/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, :: `[tensorflow::Input](/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_indices, :: `[tensorflow::Input](/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_values, :: `[tensorflow::Input](/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_shape, :: `[tensorflow::Input](/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` reduction_axes, const `[SparseReduceSumSparse::Attrs](/versions/r2.5/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](/versions/r2.5/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](/versions/r2.5/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](/versions/r2.5/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](/versions/r2.5/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](/versions/r2.5/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](/versions/r2.5/api_docs/cc/struct/tensorflow/ops/sparse-reduce-sum-sparse/attrs) | Optional attribute setters for [SparseReduceSumSparse](/versions/r2.5/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```"]]