จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เทนเซอร์โฟลว์:: ปฏิบัติการ:: กำหนด
#include <state_ops.h>
อัปเดต 'ref' โดยกำหนด 'value' ให้กับมัน
สรุป
การดำเนินการนี้จะส่งออก "ref" หลังจากการกำหนดเสร็จสิ้น ทำให้ง่ายต่อการเชื่อมโยงการดำเนินการที่ต้องใช้ค่ารีเซ็ต
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- อ้างอิง: ควรมาจากโหนด
Variable
อาจไม่ได้กำหนดค่าเริ่มต้น - ค่า: ค่าที่จะกำหนดให้กับตัวแปร
แอ็ตทริบิวต์ทางเลือก (ดู Attrs
):
- validate_shape: หากเป็นจริง การดำเนินการจะตรวจสอบว่ารูปร่างของ 'ค่า' ตรงกับรูปร่างของ เทนเซอร์ ที่ได้รับมอบหมาย หากเป็นเท็จ 'ref' จะอยู่ในรูปของ 'value'
- use_locking: หากเป็น True งานที่ได้รับมอบหมายจะได้รับการปกป้องด้วยการล็อค มิฉะนั้นพฤติกรรมจะไม่ได้กำหนดไว้ แต่อาจแสดงความขัดแย้งน้อยลง
ผลตอบแทน:
-
Output
: = เหมือนกับ "ref" กลับมาเพื่อความสะดวกสำหรับการดำเนินการที่ต้องการใช้ค่าใหม่หลังจากรีเซ็ตตัวแปรแล้ว
คุณลักษณะสาธารณะ
งานสาธารณะ
โหนด
::tensorflow::Node * node() const
operator::tensorflow::Input() const
ตัวดำเนินการ::tensorflow::เอาต์พุต
operator::tensorflow::Output() const
ฟังก์ชันคงที่สาธารณะ
ใช้ล็อค
Attrs UseLocking(
bool x
)
ตรวจสอบรูปร่าง
Attrs ValidateShape(
bool x
)
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[],[],null,["# tensorflow::ops::Assign Class Reference\n\ntensorflow::ops::Assign\n=======================\n\n`#include \u003cstate_ops.h\u003e`\n\nUpdate 'ref' by assigning 'value' to it.\n\nSummary\n-------\n\nThis operation outputs \"ref\" after the assignment is done. This makes it easier to chain operations that need to use the reset value.\n\nArguments:\n\n- scope: A [Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- ref: Should be from a [Variable](/versions/r1.15/api_docs/cc/class/tensorflow/ops/variable#classtensorflow_1_1ops_1_1_variable) node. May be uninitialized.\n- value: The value to be assigned to the variable.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/assign/attrs#structtensorflow_1_1ops_1_1_assign_1_1_attrs)):\n\n- validate_shape: If true, the operation will validate that the shape of 'value' matches the shape of the [Tensor](/versions/r1.15/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) being assigned to. If false, 'ref' will take on the shape of 'value'.\n- use_locking: If True, the assignment will be protected by a lock; otherwise the behavior is undefined, but may exhibit less contention.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): = Same as \"ref\". Returned as a convenience for operations that want to use the new value after the variable has been reset.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [Assign](#classtensorflow_1_1ops_1_1_assign_1a9d092527e56dc2c2349ea73d983cf65d)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` ref, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` value)` ||\n| [Assign](#classtensorflow_1_1ops_1_1_assign_1a8ba8288a592f24c065bcae0d32b770f6)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` ref, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` value, const `[Assign::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/assign/attrs#structtensorflow_1_1ops_1_1_assign_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_assign_1a5d4c946cbed23867a165f2da7f908730) | [Operation](/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output_ref](#classtensorflow_1_1ops_1_1_assign_1a20cf92e3af8c7164b3eb17ee05479ac2) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_assign_1a4ec3c136c0a49e9b3e9312cdb704455f)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_assign_1a3a8d284c3415f19eb7954bbf703b7af2)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_assign_1aedefc46ede817c8851373351603d9508)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|--------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|\n| [UseLocking](#classtensorflow_1_1ops_1_1_assign_1a013fcdc58dfe9ea5bfd88550e231d936)`(bool x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/assign/attrs#structtensorflow_1_1ops_1_1_assign_1_1_attrs) |\n| [ValidateShape](#classtensorflow_1_1ops_1_1_assign_1adfed4e6b56c404a19c1a4eb89e4277c8)`(bool x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/assign/attrs#structtensorflow_1_1ops_1_1_assign_1_1_attrs) |\n\n| ### Structs ||\n|--------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::Assign::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/assign/attrs) | Optional attribute setters for [Assign](/versions/r1.15/api_docs/cc/class/tensorflow/ops/assign#classtensorflow_1_1ops_1_1_assign). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output_ref\n\n```scdoc\n::tensorflow::Output output_ref\n``` \n\nPublic functions\n----------------\n\n### Assign\n\n```gdscript\n Assign(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input ref,\n ::tensorflow::Input value\n)\n``` \n\n### Assign\n\n```gdscript\n Assign(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input ref,\n ::tensorflow::Input value,\n const Assign::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### UseLocking\n\n```text\nAttrs UseLocking(\n bool x\n)\n``` \n\n### ValidateShape\n\n```text\nAttrs ValidateShape(\n bool x\n)\n```"]]