tensorflow::ops::TemporaryVariable
#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]]) สุดท้าย = state_ops._destroy_temporary_variable(var, var_name=var_name)
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- รูปร่าง: รูปร่างของเทนเซอร์ตัวแปร
- dtype: ประเภทขององค์ประกอบในเทนเซอร์ตัวแปร
คุณลักษณะเสริม (ดูที่ Attrs ):
- var_name: กำหนดค่าใหม่ให้กับชื่อที่ใช้สำหรับทรัพยากรตัวแปรชั่วคราว ค่าเริ่มต้นคือชื่อของตัวดำเนินการ ' TemporaryVariable ' (ซึ่งรับประกันว่าไม่ซ้ำกัน)
การส่งคืนสินค้า:
-
Output: การอ้างอิงถึงเทนเซอร์ตัวแปร
ตัวสร้างและตัวทำลาย | |
|---|---|
TemporaryVariable (const :: tensorflow::Scope & scope, PartialTensorShape shape, DataType dtype) | |
TemporaryVariable (const :: tensorflow::Scope & scope, PartialTensorShape shape, DataType dtype, const TemporaryVariable::Attrs & attrs) |
คุณลักษณะสาธารณะ | |
|---|---|
operation | |
ref | |
หน้าที่สาธารณะ | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
ฟังก์ชันคงที่สาธารณะ | |
|---|---|
VarName (StringPiece x) | |
โครงสร้าง | |
|---|---|
| tensorflow::ops::TemporaryVariable::Attrs | ตัวเลือกในการตั้งค่าแอตทริบิวต์สำหรับ TemporaryVariable |
คุณลักษณะสาธารณะ
การดำเนินการ
Operation operation
อ้างอิง
::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
ตัวดำเนินการ::เทนเซอร์โฟลว์::เอาต์พุต
operator::tensorflow::Output() const
ฟังก์ชันคงที่สาธารณะ
ชื่อตัวแปร
Attrs VarName( StringPiece x )