Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
dòng chảy căng:: ôi:: Biến tạm thời
#include <state_ops.h>
Trả về một tensor có thể bị thay đổi nhưng chỉ tồn tại trong một bước duy nhất.
Bản tóm tắt
Đây là một hoạt động thử nghiệm chỉ dành cho sử dụng nội bộ và có thể sử dụng hoạt động này theo những cách không an toàn. KHÔNG SỬ DỤNG trừ khi bạn hiểu đầy đủ các rủi ro.
Trách nhiệm của người gọi là đảm bảo rằng 'ref' cuối cùng được chuyển đến op ' DestroyTemporaryVariable ' phù hợp sau khi tất cả các mục đích sử dụng khác đã hoàn thành.
Xuất ra một tham chiếu đến trạng thái tensor để nó có thể được đọc hoặc sửa đổi.
Ví dụ: var = state_ops._temporary_variable([1, 2], type.float_) var_name = var.op.name var = state_ops.task(var, [[4.0, 5.0]]) var = state_ops.sign_add(var, [[ 6.0, 7.0]]) cuối cùng = state_ops._destroy_temporary_variable(var, var_name=var_name)
Lập luận:
- phạm vi: Một đối tượng Phạm vi
- hình dạng: Hình dạng của tensor thay đổi.
- dtype: Loại phần tử trong biến tensor.
Thuộc tính tùy chọn (xem Attrs
):
- var_name: Ghi đè tên được sử dụng cho biến tài nguyên tạm thời. Giá trị mặc định là tên của op ' TemporaryVariable ' (được đảm bảo là duy nhất).
Trả về:
-
Output
: Một tham chiếu đến biến tensor.
Các hàm tĩnh công khai |
---|
VarName (StringPiece x) | |
Thuộc tính công khai
Chức năng công cộng
Biến tạm thời
TemporaryVariable(
const ::tensorflow::Scope & scope,
PartialTensorShape shape,
DataType dtype
)
nút
::tensorflow::Node * node() const
operator::tensorflow::Input() const
toán tử::tenorflow::Đầu ra
operator::tensorflow::Output() const
Các hàm tĩnh công khai
Tên Var
Attrs VarName(
StringPiece x
)
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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```"]]