จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เทนเซอร์โฟลว์:: ปฏิบัติการ:: เบาบางลดผลรวม
#include <sparse_ops.h>
คำนวณผลรวมขององค์ประกอบในมิติของ SparseTensor
สรุป
Op นี้ใช้ SparseTensor และเป็นคู่ที่กระจัดกระจายกับ tf.reduce_sum()
โดยเฉพาะอย่างยิ่ง Op นี้ยังส่งคืน Tensor
ที่มีความหนาแน่นแทนที่จะเป็นแบบกระจัดกระจาย
ลด sp_input
ตามขนาดที่กำหนดใน reduction_axes
ยกเว้นในกรณีที่ keep_dims
เป็นจริง อันดับของเมตริกซ์จะลดลง 1 สำหรับแต่ละรายการใน reduction_axes
หาก keep_dims
เป็นจริง มิติที่ลดลงจะถูกคงไว้โดยมีความยาว 1
หาก reduction_axes
ไม่มีรายการ มิติข้อมูลทั้งหมดจะถูกลดขนาด และส่งคืนเทนเซอร์ที่มีองค์ประกอบเดียว นอกจากนี้ แกนอาจเป็นค่าลบ ซึ่งจะถูกตีความตามกฎการจัดทำดัชนีใน Python
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- input_indices: 2-D เมทริกซ์
N x R
พร้อมดัชนีของค่าที่ไม่ว่างเปล่าใน SparseTensor อาจไม่อยู่ในลำดับตามรูปแบบบัญญัติ - input_values: 1-D
N
ค่าที่ไม่ว่างซึ่งสอดคล้องกับ input_indices
- input_shape: 1-D รูปร่างของอินพุต SparseTensor
- ลดแกน: 1-D ความยาว- เวกเตอร์
K
ที่มีแกนลด
แอ็ตทริบิวต์ทางเลือก (ดู Attrs
):
- keep_dims: หากเป็นจริง ให้คงขนาดที่ลดลงโดยมีความยาว 1
ผลตอบแทน:
คุณลักษณะสาธารณะ
งานสาธารณะ
โหนด
::tensorflow::Node * node() const
operator::tensorflow::Input() const
ตัวดำเนินการ::tensorflow::เอาต์พุต
operator::tensorflow::Output() const
ฟังก์ชันคงที่สาธารณะ
KeepDims
Attrs KeepDims(
bool x
)
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[],[],null,["# tensorflow::ops::SparseReduceSum Class Reference\n\ntensorflow::ops::SparseReduceSum\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 particular, this Op also returns a dense [Tensor](/versions/r1.15/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) instead of a sparse one.\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\nArguments:\n\n- scope: A [Scope](/versions/r1.15/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](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/sparse-reduce-sum/attrs#structtensorflow_1_1ops_1_1_sparse_reduce_sum_1_1_attrs)):\n\n- keep_dims: If true, retain reduced dimensions with length 1.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): `R-K`-D. The reduced [Tensor](/versions/r1.15/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor).\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [SparseReduceSum](#classtensorflow_1_1ops_1_1_sparse_reduce_sum_1a31f677c3b19d0710fb02fab6474e8f18)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_indices, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_values, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_shape, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` reduction_axes)` ||\n| [SparseReduceSum](#classtensorflow_1_1ops_1_1_sparse_reduce_sum_1a8d3151db2dd2eaf6a347aed70d3bb7ec)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_indices, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_values, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_shape, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` reduction_axes, const `[SparseReduceSum::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/sparse-reduce-sum/attrs#structtensorflow_1_1ops_1_1_sparse_reduce_sum_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|-----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_sparse_reduce_sum_1a4d9aa91a20be8c1e507dbbaf92bc5fee) | [Operation](/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_sparse_reduce_sum_1a7e00bc9e8f78ba705bbdcb0c00ccafb4) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|-----------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_sparse_reduce_sum_1a61bca8cf985cd2ede755ad70f8a24159)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_sparse_reduce_sum_1a07a158d5f8094c296f78a42957ca9618)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_sparse_reduce_sum_1a49009e1c5d20e23d3069807f419177ac)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|\n| [KeepDims](#classtensorflow_1_1ops_1_1_sparse_reduce_sum_1a673e06d6ba6fee5fe24fa8044a62ca1c)`(bool x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/sparse-reduce-sum/attrs#structtensorflow_1_1ops_1_1_sparse_reduce_sum_1_1_attrs) |\n\n| ### Structs ||\n|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::SparseReduceSum::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/sparse-reduce-sum/attrs) | Optional attribute setters for [SparseReduceSum](/versions/r1.15/api_docs/cc/class/tensorflow/ops/sparse-reduce-sum#classtensorflow_1_1ops_1_1_sparse_reduce_sum). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### SparseReduceSum\n\n```gdscript\n SparseReduceSum(\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### SparseReduceSum\n\n```gdscript\n SparseReduceSum(\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 SparseReduceSum::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### KeepDims\n\n```text\nAttrs KeepDims(\n bool x\n)\n```"]]