tensorflow::ops::SparseApplyMomentum
#include <training_ops.h>อัปเดตรายการที่เกี่ยวข้องใน '*var' และ '*accum' ตามแผนการคำนวณโมเมนตัม
สรุป
ตั้งค่า use_nesterov = True หากต้องการใช้โมเมนตัมของ Nesterov
สำหรับแถวที่เรามีค่า grad เราจะอัปเดตค่า var และ accum ดังนี้:
$$accum = accum * momentum + grad$$ $$var -= lr * accum$$
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- var: ควรมาจาก Variable()
- accum: ควรมาจาก Variable()
- lr: อัตราการเรียนรู้ ต้องเป็นค่าคงที่ (scalar)
- grad: ค่าความชัน
- ดัชนี: เวกเตอร์ของดัชนีในมิติแรกของ var และ accum
- โมเมนตัม: โมเมนตัม ต้องเป็นปริมาณสเกลาร์
คุณลักษณะเสริม (ดูที่ Attrs ):
- use_locking: หากตั้งค่า
Trueการอัปเดตเทนเซอร์ var และ accum จะได้รับการป้องกันด้วยการล็อก มิเช่นนั้นพฤติกรรมจะไม่แน่นอน แต่การแย่งชิงทรัพยากรอาจน้อยลง - use_nesterov: ถ้า
Trueเทนเซอร์ที่ส่งไปยังฟังก์ชัน compute grad จะเป็น var - lr * momentum * accum ดังนั้นในท้ายที่สุด ค่า var ที่คุณได้รับก็คือ var - lr * momentum * accum นั่นเอง
การส่งคืนสินค้า:
-
Output: เหมือนกับ "var"
ตัวสร้างและตัวทำลาย | |
|---|---|
SparseApplyMomentum (const :: tensorflow::Scope & scope, :: tensorflow::Input var, :: tensorflow::Input accum, :: tensorflow::Input lr, :: tensorflow::Input grad, :: tensorflow::Input indices, :: tensorflow::Input momentum) | |
SparseApplyMomentum (const :: tensorflow::Scope & scope, :: tensorflow::Input var, :: tensorflow::Input accum, :: tensorflow::Input lr, :: tensorflow::Input grad, :: tensorflow::Input indices, :: tensorflow::Input momentum, const SparseApplyMomentum::Attrs & attrs) |
คุณลักษณะสาธารณะ | |
|---|---|
operation | |
out | |
หน้าที่สาธารณะ | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
ฟังก์ชันคงที่สาธารณะ | |
|---|---|
UseLocking (bool x) | |
UseNesterov (bool x) | |
โครงสร้าง | |
|---|---|
| tensorflow::ops::SparseApplyMomentum::Attrs | ตัวเลือกการตั้งค่าแอตทริบิวต์สำหรับ SparseApplyMomentum ( ไม่บังคับ) |
คุณลักษณะสาธารณะ
การดำเนินการ
Operation operation
ออก
::tensorflow::Output out
หน้าที่สาธารณะ
SparseApplyMomentum
SparseApplyMomentum( const ::tensorflow::Scope & scope, ::tensorflow::Input var, ::tensorflow::Input accum, ::tensorflow::Input lr, ::tensorflow::Input grad, ::tensorflow::Input indices, ::tensorflow::Input momentum )
SparseApplyMomentum
SparseApplyMomentum( const ::tensorflow::Scope & scope, ::tensorflow::Input var, ::tensorflow::Input accum, ::tensorflow::Input lr, ::tensorflow::Input grad, ::tensorflow::Input indices, ::tensorflow::Input momentum, const SparseApplyMomentum::Attrs & attrs )
โหนด
::tensorflow::Node * node() const
ตัวดำเนินการ::เทนเซอร์โฟลว์::อินพุต
operator::tensorflow::Input() const
ตัวดำเนินการ::เทนเซอร์โฟลว์::เอาต์พุต
operator::tensorflow::Output() const
ฟังก์ชันคงที่สาธารณะ
ใช้การล็อก
Attrs UseLocking( bool x )
UseNesterov
Attrs UseNesterov( bool x )