جریان تنسور:: عملیات:: SparseReshape
#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
است.
استدلال ها:
- scope: یک شی Scope
- input_indeces: 2-D. ماتریس
N x R_in
با شاخص های مقادیر غیر خالی در SparseTensor. - input_shape: 1-D. بردار
R_in
با شکل متراکم SparseTensor ورودی. - new_shape: 1-D. بردار
R_out
با شکل متراکم جدید درخواستی.
برمی گرداند:
-
Output
: 2-D. ماتریس N x R_out
با شاخص های به روز شده مقادیر غیر خالی در خروجی SparseTensor. -
Output
: 1-D. بردار R_out
با شکل کامل متراکم خروجی SparseTensor. این همان new_shape
است اما با هر بعد -1 پر شده است.
صفات عمومی
عملیات
Operation operation
خروجی_شاخص ها
::tensorflow::Output output_indices
خروجی_شکل
::tensorflow::Output output_shape
توابع عمومی
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-26 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-26 بهوقت ساعت هماهنگ جهانی."],[],[],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```"]]