เทนเซอร์โฟลว์:: ปฏิบัติการ:: ตัวแปรชั่วคราว

#include <state_ops.h>

ส่งกลับเทนเซอร์ที่อาจกลายพันธุ์ แต่คงอยู่ในขั้นตอนเดียวเท่านั้น

สรุป

นี่เป็นปฏิบัติการทดลองสำหรับการใช้งานภายในเท่านั้น และเป็นไปได้ที่จะใช้ปฏิบัติการนี้ในลักษณะที่ไม่ปลอดภัย ห้ามใช้เว้นแต่คุณจะเข้าใจถึงความเสี่ยงอย่างถ่องแท้

เป็นความรับผิดชอบของผู้เรียกที่จะต้องแน่ใจว่าในที่สุด 'ref' จะถูกส่งผ่านไปยัง op ' 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: แทนที่ชื่อที่ใช้สำหรับทรัพยากรตัวแปรชั่วคราว ค่าเริ่มต้นคือชื่อของ op ' 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)

โครงสร้าง

เทนเซอร์โฟลว์ :: 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 

ตัวดำเนินการ::tensorflow::อินพุต

 operator::tensorflow::Input() const 

ตัวดำเนินการ::tensorflow::เอาต์พุต

 operator::tensorflow::Output() const 

ฟังก์ชันคงที่สาธารณะ

VarName

Attrs VarName(
  StringPiece x
)