จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เทนเซอร์โฟลว์:: ปฏิบัติการ:: เบาบางเพิ่ม
#include <sparse_ops.h>
เพิ่มวัตถุ SparseTensor
สองรายการเพื่อสร้าง SparseTensor
อื่น
สรุป
ดัชนีของวัตถุ SparseTensor
อินพุตจะถือว่าเรียงลำดับตามลำดับพจนานุกรมมาตรฐาน หากไม่เป็นเช่นนั้น ก่อนที่ขั้นตอนนี้จะรัน SparseReorder
เพื่อเรียกคืนการเรียงลำดับดัชนี
ตามค่าเริ่มต้น หากค่าสองค่ารวมกันเป็นศูนย์ในบางดัชนี เอาต์พุต SparseTensor
จะยังคงรวมตำแหน่งนั้นไว้ในดัชนี โดยจัดเก็บค่าศูนย์ในช่องค่าที่สอดคล้องกัน หากต้องการแทนที่สิ่งนี้ ผู้เรียกสามารถระบุ thresh
ได้ ซึ่งบ่งชี้ว่าหากผลรวมมีขนาดเล็กกว่า thresh
อย่างเคร่งครัด ค่าและดัชนีที่สอดคล้องกันก็จะไม่รวมอยู่ด้วย โดยเฉพาะอย่างยิ่ง thresh == 0
(ค่าเริ่มต้น) หมายความว่าทุกอย่างจะถูกเก็บไว้ และขีดจำกัดที่แท้จริงจะเกิดขึ้นสำหรับค่าบวกเท่านั้น
ในรูปทรงต่อไปนี้ nnz
คือการนับหลังจากคำนึงถึง thresh
แล้ว
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- a_ดัชนี: 2-D
indices
ของ SparseTensor
ตัวแรก ขนาด [nnz, ndims]
Matrix - a_values: 1-D
values
ของ SparseTensor
ตัวแรก ขนาด [nnz]
Vector - a_รูปร่าง: 1-D
shape
ของ SparseTensor
ตัวแรก ขนาด [ndims]
Vector - b_ดัชนี: 2-D
indices
ของ SparseTensor
ตัวที่สอง ขนาด [nnz, ndims]
Matrix - b_values: 1-D
values
ของ SparseTensor
ตัวที่สอง ขนาด [nnz]
Vector - b_รูปร่าง: 1-D
shape
ของ SparseTensor
ตัวที่สอง ขนาด [ndims]
Vector - นวดข้าว: 0-D เกณฑ์ขนาดที่กำหนดว่าค่าเอาต์พุต/คู่ดัชนีใช้พื้นที่หรือไม่
ผลตอบแทน:
คุณลักษณะสาธารณะ
งานสาธารณะ
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[],[],null,["# tensorflow::ops::SparseAdd Class Reference\n\ntensorflow::ops::SparseAdd\n==========================\n\n`#include \u003csparse_ops.h\u003e`\n\nAdds two `SparseTensor` objects to produce another `SparseTensor`.\n\nSummary\n-------\n\nThe input `SparseTensor` objects' indices are assumed ordered in standard lexicographic order. If this is not the case, before this step run [SparseReorder](/versions/r2.3/api_docs/cc/class/tensorflow/ops/sparse-reorder#classtensorflow_1_1ops_1_1_sparse_reorder) to restore index ordering.\n\nBy default, if two values sum to zero at some index, the output `SparseTensor` would still include that particular location in its index, storing a zero in the corresponding value slot. To override this, callers can specify `thresh`, indicating that if the sum has a magnitude strictly smaller than `thresh`, its corresponding value and index would then not be included. In particular, `thresh == 0` (default) means everything is kept and actual thresholding happens only for a positive value.\n\nIn the following shapes, `nnz` is the count after taking `thresh` into account.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- a_indices: 2-D. The `indices` of the first `SparseTensor`, size `[nnz, ndims]` Matrix.\n- a_values: 1-D. The `values` of the first `SparseTensor`, size `[nnz]` Vector.\n- a_shape: 1-D. The `shape` of the first `SparseTensor`, size `[ndims]` Vector.\n- b_indices: 2-D. The `indices` of the second `SparseTensor`, size `[nnz, ndims]` Matrix.\n- b_values: 1-D. The `values` of the second `SparseTensor`, size `[nnz]` Vector.\n- b_shape: 1-D. The `shape` of the second `SparseTensor`, size `[ndims]` Vector.\n- thresh: 0-D. The magnitude threshold that determines if an output value/index pair takes space.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) sum_indices\n- [Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) sum_values\n- [Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) sum_shape\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [SparseAdd](#classtensorflow_1_1ops_1_1_sparse_add_1a07c65af8c10333ec7605e9a7f0a1be2b)`(const ::`[tensorflow::Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` a_indices, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` a_values, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` a_shape, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` b_indices, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` b_values, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` b_shape, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` thresh)` ||\n\n| ### Public attributes ||\n|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_sparse_add_1aab871539035af62dcf3df695fc396ba0) | [Operation](/versions/r2.3/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [sum_indices](#classtensorflow_1_1ops_1_1_sparse_add_1a935595157260ea9fcff05da3c0341947) | `::`[tensorflow::Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [sum_shape](#classtensorflow_1_1ops_1_1_sparse_add_1a573a3dbb573b8d6fb0172ca669d4685f) | `::`[tensorflow::Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [sum_values](#classtensorflow_1_1ops_1_1_sparse_add_1a2cc06856b4695dd0ba3ea4f686160ddf) | `::`[tensorflow::Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### sum_indices\n\n```scdoc\n::tensorflow::Output sum_indices\n``` \n\n### sum_shape\n\n```scdoc\n::tensorflow::Output sum_shape\n``` \n\n### sum_values\n\n```scdoc\n::tensorflow::Output sum_values\n``` \n\nPublic functions\n----------------\n\n### SparseAdd\n\n```gdscript\n SparseAdd(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input a_indices,\n ::tensorflow::Input a_values,\n ::tensorflow::Input a_shape,\n ::tensorflow::Input b_indices,\n ::tensorflow::Input b_values,\n ::tensorflow::Input b_shape,\n ::tensorflow::Input thresh\n)\n```"]]