tensorflow:: אופס:: TensorArrayGrad
#include <data_flow_ops.h>
יוצר TensorArray לאחסון ההדרגות של ערכים בנקודת האחיזה הנתונה.
תַקצִיר
אם שיפוע ה- TensorArray הנתון כבר קיים, מחזיר הפניה אליו.
נועל את הגודל של TensorArray המקורי על ידי השבתת דגל הגודל הדינמי שלו.
הערה לגבי הקלט flow_in:
ה-handle flow_in מאלץ את ביצוע בדיקת השיפוע להתרחש רק לאחר שהתרחשו פעולות מסוימות אחרות. לדוגמה, כאשר TensorArray הקדמי הוא בגודל דינמי, כתיבה אל TensorArray זה עשויה לשנות את גודל האובייקט. גודל השיפוע TensorArray הוא סטטי בהתבסס על הגודל של TensorArray הקדמי כאשר פעולה זו מבוצעת. יתר על כן, הגודל של TensorArray הקדמי מוקפא בקריאה זו. כתוצאה מכך, הזרימה משמשת כדי להבטיח שהקריאה ליצירת הגרדיאנט TensorArray מתרחשת רק לאחר ביצוע כל הכתיבה.
במקרה של TensorArrays בגודל דינמי, יש לבצע חישוב שיפוע רק על פעולות קריאה שהן עצמן משורשרות באמצעות זרימה להתרחש רק לאחר ביצוע כל הכתיבה. כך ידוע הגודל הסופי של TensorArray קדימה כאשר הפעולה הזו נקראת.
הערה לגבי תכונת המקור:
קריאות שיפוע של TensorArray משתמשות באובייקט TensorArray של מצבר. אם מחושבים שיפועים מרובים ופועלים באותה הפעלה, צמתי השיפוע המרובים עלולים לזרום בטעות דרך אותו מצבר TensorArray . כפול זה סופר ובדרך כלל שוברת את זרימת השיפוע של TensorArray .
הפתרון הוא לזהות באיזו קריאת שיפוע מתבצעת קריאה של שיפוע TensorArray הספציפי הזה. זה מבוצע על ידי זיהוי מחרוזת ייחודית (למשל "gradients", "gradients_1", ...) מהשם של שיפוע הקלט של Tensor . מחרוזת זו משמשת כסיומת בעת יצירת אובייקט הגרדיאנט TensorArray כאן ( source
התכונה ).
source
התכונה מתווסף כסיומת לשם של TensorArray קדימה בעת ביצוע היצירה / חיפוש, כך שכל חישוב גרדיאנט נפרד מקבל מצבר TensorArray משלו.
טיעונים:
- scope: אובייקט Scope
- handle: הידית אל TensorArray הקדמי .
- flow_in: סקלר צף האוכף שרשור נכון של פעולות.
- source: מחרוזת מקור השיפוע, המשמשת כדי להחליט איזה שיפוע TensorArray להחזיר.
החזרות:
תכונות ציבוריות
flow_out
::tensorflow::Output flow_out
grad_handle
::tensorflow::Output grad_handle
מִבצָע
Operation operation
תפקידים ציבוריים
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-25 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-25 (שעון UTC)."],[],[],null,["# tensorflow::ops::TensorArrayGrad Class Reference\n\ntensorflow::ops::TensorArrayGrad\n================================\n\n`#include \u003cdata_flow_ops.h\u003e`\n\nCreates a [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) for storing the gradients of values in the given handle.\n\nSummary\n-------\n\nIf the given [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) gradient already exists, returns a reference to it.\n\nLocks the size of the original [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) by disabling its dynamic size flag.\n\n\n**A note about the input flow_in:**\n\nThe handle flow_in forces the execution of the gradient lookup to occur only after certain other operations have occurred. For example, when the forward [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) is dynamically sized, writes to this [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) may resize the object. The gradient [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) is statically sized based on the size of the forward [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) when this operation executes. Furthermore, the size of the forward [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) is frozen by this call. As a result, the flow is used to ensure that the call to generate the gradient [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) only happens after all writes are executed.\n\nIn the case of dynamically sized TensorArrays, gradient computation should only be performed on read operations that have themselves been chained via flow to occur only after all writes have executed. That way the final size of the forward [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) is known when this operation is called.\n\n\n**A note about the source attribute:**\n\n[TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) gradient calls use an accumulator [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) object. If multiple gradients are calculated and run in the same session, the multiple gradient nodes may accidentally flow through the same accumulator [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array). This double counts and generally breaks the [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) gradient flow.\n\nThe solution is to identify which gradient call this particular [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) gradient is being called in. This is performed by identifying a unique string (e.g. \"gradients\", \"gradients_1\", ...) from the input gradient [Tensor](/versions/r2.1/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor)'s name. This string is used as a suffix when creating the [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) gradient object here (the attribute `source`).\n\nThe attribute `source` is added as a suffix to the forward [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array)'s name when performing the creation / lookup, so that each separate gradient calculation gets its own [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) accumulator.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- handle: The handle to the forward [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array).\n- flow_in: A float scalar that enforces proper chaining of operations.\n- source: The gradient source string, used to decide which gradient [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) to return.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) grad_handle\n- [Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) flow_out\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [TensorArrayGrad](#classtensorflow_1_1ops_1_1_tensor_array_grad_1a6240f50f9c7efdcf3bf8d48c4218d27b)`(const ::`[tensorflow::Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` handle, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` flow_in, StringPiece source)` ||\n\n| ### Public attributes ||\n|-------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [flow_out](#classtensorflow_1_1ops_1_1_tensor_array_grad_1a2499ef8bb9c633df24389a51f37654da) | `::`[tensorflow::Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [grad_handle](#classtensorflow_1_1ops_1_1_tensor_array_grad_1ab5be040d777eb52f767d58a83a3a345d) | `::`[tensorflow::Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_tensor_array_grad_1ae7c0b0022fc4a44d321bf759c55413c2) | [Operation](/versions/r2.1/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n\nPublic attributes\n-----------------\n\n### flow_out\n\n```scdoc\n::tensorflow::Output flow_out\n``` \n\n### grad_handle\n\n```scdoc\n::tensorflow::Output grad_handle\n``` \n\n### operation\n\n```text\nOperation operation\n``` \n\nPublic functions\n----------------\n\n### TensorArrayGrad\n\n```gdscript\n TensorArrayGrad(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input handle,\n ::tensorflow::Input flow_in,\n StringPiece source\n)\n```"]]