จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เทนเซอร์โฟลว์:: ปฏิบัติการ:: TensorArray
#include <data_flow_ops.h>
อาร์เรย์ของเทนเซอร์ที่มีขนาดที่กำหนด
สรุป
เขียนข้อมูลผ่าน Write และอ่านผ่าน Read หรือ Pack
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- ขนาด: ขนาดของอาร์เรย์
- dtype: ประเภทขององค์ประกอบบน tensor_array
แอ็ตทริบิวต์ทางเลือก (ดู Attrs
):
- element_shape: รูปร่างที่คาดหวังขององค์ประกอบ หากทราบ ใช้เพื่อตรวจสอบรูปร่างขององค์ประกอบ TensorArray หากไม่ได้ระบุรูปร่างนี้อย่างสมบูรณ์ การรวบรวม TensorArrays ขนาดศูนย์ถือเป็นข้อผิดพลาด
- dynamic_size: บูลีนที่กำหนดว่าจะอนุญาตให้เขียนไปยัง TensorArray เพื่อเพิ่มขนาดหรือไม่ โดยค่าเริ่มต้น สิ่งนี้ไม่ได้รับอนุญาต
- clear_after_read: หากเป็นจริง (ค่าเริ่มต้น) เทนเซอร์ใน TensorArray จะถูกล้างหลังจากอ่านแล้ว สิ่งนี้จะปิดใช้งานซีแมนทิกส์การอ่านหลายรายการ แต่อนุญาตให้ปล่อยหน่วยความจำล่วงหน้าได้
- เหมือนกัน_องค์ประกอบ_รูปร่าง: หากเป็นจริง (ค่าเริ่มต้นคือเท็จ) องค์ประกอบทั้งหมดใน TensorArray จะต้องมีรูปร่างเหมือนกัน ซึ่งช่วยให้เกิดพฤติกรรมบางอย่างได้ เช่น การตรวจสอบรูปร่างที่สอดคล้องกันแบบไดนามิกในการเขียน และความสามารถในการเติมเทนเซอร์ศูนย์ที่มีรูปทรงอย่างเหมาะสมบนสแต็ก แม้ว่าแอตทริบิวต์ element_shape จะไม่ได้กำหนดไว้อย่างสมบูรณ์ก็ตาม
- tensor_array_name: แทนที่ชื่อที่ใช้สำหรับทรัพยากร tensor_array_name ชั่วคราว ค่าเริ่มต้นคือชื่อของ op ' TensorArray ' (ซึ่งรับประกันว่าไม่ซ้ำกัน)
ผลตอบแทน:
คุณลักษณะสาธารณะ
งานสาธารณะ
ฟังก์ชันคงที่สาธารณะ
ล้างหลังจากอ่าน
Attrs ClearAfterRead(
bool x
)
ขนาดไดนามิก
Attrs DynamicSize(
bool x
)
องค์ประกอบรูปร่าง
Attrs ElementShape(
PartialTensorShape x
)
รูปร่างองค์ประกอบที่เหมือนกัน
Attrs IdenticalElementShapes(
bool x
)
TensorArrayName
Attrs TensorArrayName(
StringPiece x
)
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[],[],null,["# tensorflow::ops::TensorArray Class Reference\n\ntensorflow::ops::TensorArray\n============================\n\n`#include \u003cdata_flow_ops.h\u003e`\n\nAn array of Tensors of given size.\n\nSummary\n-------\n\nWrite data via Write and read via Read or Pack.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- size: The size of the array.\n- dtype: The type of the elements on the tensor_array.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/tensor-array/attrs#structtensorflow_1_1ops_1_1_tensor_array_1_1_attrs)):\n\n- element_shape: The expected shape of an element, if known. Used to validate the shapes of [TensorArray](/versions/r2.3/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) elements. If this shape is not fully specified, gathering zero-size TensorArrays is an error.\n- dynamic_size: A boolean that determines whether writes to the [TensorArray](/versions/r2.3/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) are allowed to grow the size. By default, this is not allowed.\n- clear_after_read: If true (default), Tensors in the [TensorArray](/versions/r2.3/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) are cleared after being read. This disables multiple read semantics but allows early release of memory.\n- identical_element_shapes: If true (default is false), then all elements in the [TensorArray](/versions/r2.3/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) will be expected to have have identical shapes. This allows certain behaviors, like dynamically checking for consistent shapes on write, and being able to fill in properly shaped zero tensors on stack even if the element_shape attribute is not fully defined.\n- tensor_array_name: Overrides the name used for the temporary tensor_array resource. Default value is the name of the '[TensorArray](/versions/r2.3/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array)' 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) handle: The handle to the [TensorArray](/versions/r2.3/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array).\n- [Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) flow: A scalar used to control gradient flow.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [TensorArray](#classtensorflow_1_1ops_1_1_tensor_array_1a17fb1bdb76e98f8c83ec1cf24af87f3d)`(const ::`[tensorflow::Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` size, DataType dtype)` ||\n| [TensorArray](#classtensorflow_1_1ops_1_1_tensor_array_1afede14d69c65d1efdc36f5ac00fc6351)`(const ::`[tensorflow::Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` size, DataType dtype, const `[TensorArray::Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/tensor-array/attrs#structtensorflow_1_1ops_1_1_tensor_array_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [flow](#classtensorflow_1_1ops_1_1_tensor_array_1ac6f0c80567abf77dbae5528ef5257c3c) | `::`[tensorflow::Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [handle](#classtensorflow_1_1ops_1_1_tensor_array_1a238401c92769f36d04f2f3b2db163fdf) | `::`[tensorflow::Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_tensor_array_1a1b6149ac5da344ccb1561eefc5b0b25a) | [Operation](/versions/r2.3/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n\n| ### Public static functions ||\n|---------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|\n| [ClearAfterRead](#classtensorflow_1_1ops_1_1_tensor_array_1ada85e1cd0c0611935f275655748441b6)`(bool x)` | [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/tensor-array/attrs#structtensorflow_1_1ops_1_1_tensor_array_1_1_attrs) |\n| [DynamicSize](#classtensorflow_1_1ops_1_1_tensor_array_1a3022cd4fccb5d056d0e670d51ad424b4)`(bool x)` | [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/tensor-array/attrs#structtensorflow_1_1ops_1_1_tensor_array_1_1_attrs) |\n| [ElementShape](#classtensorflow_1_1ops_1_1_tensor_array_1a4d87fc9eee4243549ee11e45bb697ba9)`(PartialTensorShape x)` | [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/tensor-array/attrs#structtensorflow_1_1ops_1_1_tensor_array_1_1_attrs) |\n| [IdenticalElementShapes](#classtensorflow_1_1ops_1_1_tensor_array_1a6e6597bdcb607f327ba2047f3dafa449)`(bool x)` | [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/tensor-array/attrs#structtensorflow_1_1ops_1_1_tensor_array_1_1_attrs) |\n| [TensorArrayName](#classtensorflow_1_1ops_1_1_tensor_array_1a26c71247662a164badad7ad3004f3409)`(StringPiece x)` | [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/tensor-array/attrs#structtensorflow_1_1ops_1_1_tensor_array_1_1_attrs) |\n\n| ### Structs ||\n|------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::TensorArray::Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/tensor-array/attrs) | Optional attribute setters for [TensorArray](/versions/r2.3/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array). |\n\nPublic attributes\n-----------------\n\n### flow\n\n```text\n::tensorflow::Output flow\n``` \n\n### handle\n\n```text\n::tensorflow::Output handle\n``` \n\n### operation\n\n```text\nOperation operation\n``` \n\nPublic functions\n----------------\n\n### TensorArray\n\n```gdscript\n TensorArray(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input size,\n DataType dtype\n)\n``` \n\n### TensorArray\n\n```gdscript\n TensorArray(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input size,\n DataType dtype,\n const TensorArray::Attrs & attrs\n)\n``` \n\nPublic static functions\n-----------------------\n\n### ClearAfterRead\n\n```text\nAttrs ClearAfterRead(\n bool x\n)\n``` \n\n### DynamicSize\n\n```text\nAttrs DynamicSize(\n bool x\n)\n``` \n\n### ElementShape\n\n```text\nAttrs ElementShape(\n PartialTensorShape x\n)\n``` \n\n### IdenticalElementShapes\n\n```text\nAttrs IdenticalElementShapes(\n bool x\n)\n``` \n\n### TensorArrayName\n\n```text\nAttrs TensorArrayName(\n StringPiece x\n)\n```"]]