จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เทนเซอร์โฟลว์:: ปฏิบัติการ:: เบาบางปรับรูปร่างใหม่
#include <sparse_ops.h>
ปรับรูปร่าง SparseTensor ใหม่เพื่อแสดงค่าในรูปร่างหนาแน่นใหม่
สรุป
การดำเนินการนี้มีความหมายเหมือนกับการปรับรูปร่างใหม่บนเทนเซอร์หนาแน่นที่เป็นตัวแทน input_indices
จะถูกคำนวณใหม่ตาม new_shape
ที่ร้องขอ
หากส่วนประกอบหนึ่งของ new_shape
คือค่าพิเศษ -1 ขนาดของมิตินั้นจะถูกคำนวณเพื่อให้ขนาดความหนาแน่นรวมคงที่ ส่วนประกอบของ new_shape
สามารถเป็น -1 ได้มากที่สุดหนึ่งองค์ประกอบ จำนวนองค์ประกอบหนาแน่นที่นัยโดย new_shape
จะต้องเท่ากับจำนวนองค์ประกอบหนาแน่นที่เดิมนัยโดย input_shape
การปรับรูปร่างใหม่จะไม่ส่งผลต่อลำดับของค่าใน SparseTensor
หากเทนเซอร์อินพุตมีอันดับ R_in
และ N
ค่าที่ไม่ว่างเปล่า และ new_shape
มีความยาว R_out
ดังนั้น input_indices
จะมีรูปร่าง [N, R_in]
, input_shape
มีความยาว R_in
, output_indices
มีรูปร่าง [N, R_out]
และ output_shape
มีความยาว R_out
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- input_indices: 2-D เมทริกซ์
N x R_in
พร้อมดัชนีของค่าที่ไม่ว่างใน SparseTensor - input_shape: 1-D เวกเตอร์
R_in
ที่มีรูปร่างหนาแน่นของ SparseTensor อินพุต - new_shape: 1-D เวกเตอร์
R_out
ที่มีรูปร่างหนาแน่นใหม่ที่ร้องขอ
ผลตอบแทน:
-
Output
output_indices: 2-D เมทริกซ์ N x R_out
พร้อมดัชนีที่อัปเดตของค่าที่ไม่ว่างเปล่าในเอาต์พุต SparseTensor -
Output
เอาต์พุต_รูปร่าง: 1-D เวกเตอร์ R_out
ที่มีรูปร่างหนาแน่นเต็มของเอาต์พุต SparseTensor สิ่งนี้เหมือนกับ new_shape
แต่เติมมิติข้อมูล -1 ลงไป
คุณลักษณะสาธารณะ
งานสาธารณะ
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[],[],null,["# tensorflow::ops::SparseReshape Class Reference\n\ntensorflow::ops::SparseReshape\n==============================\n\n`#include \u003csparse_ops.h\u003e`\n\nReshapes a SparseTensor to represent values in a new dense shape.\n\nSummary\n-------\n\nThis operation has the same semantics as reshape on the represented dense tensor. The `input_indices` are recomputed based on the requested `new_shape`.\n\nIf one component of `new_shape` is the special value -1, the size of that dimension is computed so that the total dense size remains constant. At most one component of `new_shape` can be -1. The number of dense elements implied by `new_shape` must be the same as the number of dense elements originally implied by `input_shape`.\n\nReshaping does not affect the order of values in the SparseTensor.\n\nIf the input tensor has rank `R_in` and `N` non-empty values, and `new_shape` has length `R_out`, then `input_indices` has shape `[N, R_in]`, `input_shape` has length `R_in`, `output_indices` has shape `[N, R_out]`, and `output_shape` has length `R_out`.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input_indices: 2-D. `N x R_in` matrix with the indices of non-empty values in a SparseTensor.\n- input_shape: 1-D. `R_in` vector with the input SparseTensor's dense shape.\n- new_shape: 1-D. `R_out` vector with the requested new dense shape.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output_indices: 2-D. `N x R_out` matrix with the updated indices of non-empty values in the output SparseTensor.\n- [Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output_shape: 1-D. `R_out` vector with the full dense shape of the output SparseTensor. This is the same as `new_shape` but with any -1 dimensions filled in.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [SparseReshape](#classtensorflow_1_1ops_1_1_sparse_reshape_1a57501c2498594b147ac9bb4b371ab2ef)`(const ::`[tensorflow::Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_indices, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_shape, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` new_shape)` ||\n\n| ### Public attributes ||\n|-------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_sparse_reshape_1a19240d0378428b2bf0b30ef7badcea50) | [Operation](/versions/r2.0/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output_indices](#classtensorflow_1_1ops_1_1_sparse_reshape_1a3c4d3f0b4883e4bacc4c3ba450e72431) | `::`[tensorflow::Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [output_shape](#classtensorflow_1_1ops_1_1_sparse_reshape_1a93b02c760fe2a4ea9a8495f1f8151c51) | `::`[tensorflow::Output](/versions/r2.0/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### 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\nPublic functions\n----------------\n\n### SparseReshape\n\n```gdscript\n SparseReshape(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input_indices,\n ::tensorflow::Input input_shape,\n ::tensorflow::Input new_shape\n)\n```"]]