tensorflow:: אופס:: משתנה זמני
#include <state_ops.h>
מחזירה טנזור שעשוי לעבור מוטציה, אך נמשך רק בשלב אחד.
תַקצִיר
זהו אופציה ניסיונית לשימוש פנימי בלבד וניתן להשתמש באופ זה בדרכים לא בטוחות. אל תשתמש אלא אם כן אתה מבין היטב את הסיכונים.
באחריות המתקשר לוודא ש'ref' יועבר בסופו של דבר לאופציה ' DestroyTemporaryVariable ' תואמת לאחר השלמת כל שאר השימושים.
מוציא רפר למצב הטנזור כך שניתן לקרוא אותו או לשנותו.
למשל var = state_ops._temporary_variable([1, 2], types.float_) var_name = var.op.name var = state_ops.assign(var, [[4.0, 5.0]]) var = state_ops.assign_add(var, [[ 6.0, 7.0]]) final = state_ops._destroy_temporary_variable(var, var_name=var_name)
טיעונים:
- scope: אובייקט Scope
- צורה: צורת הטנזור המשתנה.
- dtype: סוג האלמנטים בטנזור המשתנה.
מאפיינים אופציונליים (ראה Attrs
):
- var_name: עוקף את השם המשמש למשאב המשתנה הזמני. ערך ברירת המחדל הוא השם של האופציה ' TemporaryVariable ' (שהיא מובטחת ייחודית).
החזרות:
-
Output
: התייחסות לטנזור המשתנה.
פונקציות סטטיות ציבוריות |
---|
VarName (StringPiece x) | |
תכונות ציבוריות
מִבצָע
Operation operation
ref
::tensorflow::Output ref
תפקידים ציבוריים
משתנה זמני
TemporaryVariable(
const ::tensorflow::Scope & scope,
PartialTensorShape shape,
DataType dtype
)
משתנה זמני
TemporaryVariable(
const ::tensorflow::Scope & scope,
PartialTensorShape shape,
DataType dtype,
const TemporaryVariable::Attrs & attrs
)
צוֹמֶת
::tensorflow::Node * node() const
operator::tensorflow::Input() const
אופרטור::tensorflow::פלט
operator::tensorflow::Output() const
פונקציות סטטיות ציבוריות
VarName
Attrs VarName(
StringPiece x
)
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-27 (שעון UTC)."],[],[],null,["# tensorflow::ops::TemporaryVariable Class Reference\n\ntensorflow::ops::TemporaryVariable\n==================================\n\n`#include \u003cstate_ops.h\u003e`\n\nReturns a tensor that may be mutated, but only persists within a single step.\n\nSummary\n-------\n\nThis is an experimental op for internal use only and it is possible to use this op in unsafe ways. DO NOT USE unless you fully understand the risks.\n\nIt is the caller's responsibility to ensure that 'ref' is eventually passed to a matching '[DestroyTemporaryVariable](/versions/r2.3/api_docs/cc/class/tensorflow/ops/destroy-temporary-variable#classtensorflow_1_1ops_1_1_destroy_temporary_variable)' op after all other uses have completed.\n\nOutputs a ref to the tensor state so it may be read or modified.\n\nE.g. var = state_ops._temporary_variable(\\[1, 2\\], types.float_) var_name = var.op.name var = state_ops.assign(var, \\[\\[4.0, 5.0\\]\\]) var = state_ops.assign_add(var, \\[\\[6.0, 7.0\\]\\]) final = state_ops._destroy_temporary_variable(var, var_name=var_name)\n\nArguments:\n\n- scope: A [Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- shape: The shape of the variable tensor.\n- dtype: The type of elements in the variable tensor.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/temporary-variable/attrs#structtensorflow_1_1ops_1_1_temporary_variable_1_1_attrs)):\n\n- var_name: Overrides the name used for the temporary variable resource. Default value is the name of the '[TemporaryVariable](/versions/r2.3/api_docs/cc/class/tensorflow/ops/temporary-variable#classtensorflow_1_1ops_1_1_temporary_variable)' op (which is guaranteed unique).\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): A reference to the variable tensor.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [TemporaryVariable](#classtensorflow_1_1ops_1_1_temporary_variable_1a694e6c48eaf39d57f59d52796a9a71d1)`(const ::`[tensorflow::Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, PartialTensorShape shape, DataType dtype)` ||\n| [TemporaryVariable](#classtensorflow_1_1ops_1_1_temporary_variable_1a43909369fdad702faf95e5aab8346b1a)`(const ::`[tensorflow::Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, PartialTensorShape shape, DataType dtype, const `[TemporaryVariable::Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/temporary-variable/attrs#structtensorflow_1_1ops_1_1_temporary_variable_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_temporary_variable_1abf90e66f914f45a8e9c11f7409917423) | [Operation](/versions/r2.3/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [ref](#classtensorflow_1_1ops_1_1_temporary_variable_1a62601e5fd1b28bd28a6f0db0c691fe61) | `::`[tensorflow::Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|------------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_temporary_variable_1a3dbe9a732d4ec4ab4f94240c0ba61210)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_temporary_variable_1a8414b80274ac7ca395a565b59e90cd9e)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_temporary_variable_1a62b24d2f958c91a5a1005127d7056dc9)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|---------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|\n| [VarName](#classtensorflow_1_1ops_1_1_temporary_variable_1a6647c19d0e761d2c6c11ff667576cfb5)`(StringPiece x)` | [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/temporary-variable/attrs#structtensorflow_1_1ops_1_1_temporary_variable_1_1_attrs) |\n\n| ### Structs ||\n|------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::TemporaryVariable::Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/temporary-variable/attrs) | Optional attribute setters for [TemporaryVariable](/versions/r2.3/api_docs/cc/class/tensorflow/ops/temporary-variable#classtensorflow_1_1ops_1_1_temporary_variable). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### ref\n\n```text\n::tensorflow::Output ref\n``` \n\nPublic functions\n----------------\n\n### TemporaryVariable\n\n```gdscript\n TemporaryVariable(\n const ::tensorflow::Scope & scope,\n PartialTensorShape shape,\n DataType dtype\n)\n``` \n\n### TemporaryVariable\n\n```gdscript\n TemporaryVariable(\n const ::tensorflow::Scope & scope,\n PartialTensorShape shape,\n DataType dtype,\n const TemporaryVariable::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### VarName\n\n```text\nAttrs VarName(\n StringPiece x\n)\n```"]]