dòng chảy căng:: ôi:: thưa thớtÁp dụngFtrl
#include <training_ops.h>
Cập nhật các mục nhập có liên quan trong '*var' theo sơ đồ gần Ftrl.
Bản tóm tắt
Đó là đối với các hàng chúng tôi có grad, chúng tôi cập nhật var, accum và tuyến tính như sau:
accumnew=accum+grad∗grad
linear+=grad+(accum−lrpowernew−accum−lrpower/lr∗var
quadratic=1.0/(accumlrpowernew∗lr)+2∗l2
var=(sign(linear)∗l1−linear)/quadratic if |linear|>l1 else 0.0
accum=accumnew
Lập luận:
- phạm vi: Một đối tượng Phạm vi
- var: Phải từ một Biến().
- tích lũy: Phải từ một Biến().
- tuyến tính: Phải từ một Biến().
- grad: Độ dốc.
- chỉ số: Một vectơ chỉ số vào chiều thứ nhất của var và accum.
- lr: Hệ số tỷ lệ. Phải là một vô hướng.
- l1: Chính quy hóa L1. Phải là một vô hướng.
- l2: Chính quy hóa L2. Phải là một vô hướng.
- lr_power: Hệ số tỷ lệ. Phải là một vô hướng.
Thuộc tính tùy chọn (xem Attrs
):
- use_locking: Nếu
True
, việc cập nhật các tensor var và accum sẽ được bảo vệ bằng khóa; mặt khác, hành vi không được xác định, nhưng có thể ít gây tranh cãi hơn.
Trả về:
-
Output
: Giống như "var".
Hàm tạo và hàm hủy | |
---|---|
SparseApplyFtrl (const :: tensorflow::Scope & scope, :: tensorflow::Input var, :: tensorflow::Input accum, :: tensorflow::Input linear, :: tensorflow::Input grad, :: tensorflow::Input indices, :: tensorflow::Input lr, :: tensorflow::Input l1, :: tensorflow::Input l2, :: tensorflow::Input lr_power) | |
SparseApplyFtrl (const :: tensorflow::Scope & scope, :: tensorflow::Input var, :: tensorflow::Input accum, :: tensorflow::Input linear, :: tensorflow::Input grad, :: tensorflow::Input indices, :: tensorflow::Input lr, :: tensorflow::Input l1, :: tensorflow::Input l2, :: tensorflow::Input lr_power, const SparseApplyFtrl::Attrs & attrs) |
Chức năng công cộng | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
Các hàm tĩnh công khai | |
---|---|
MultiplyLinearByLr (bool x) | |
UseLocking (bool x) |
Cấu trúc | |
---|---|
tenorflow:: ops:: SparseApplyFtrl:: Attrs | Bộ cài đặt thuộc tính tùy chọn cho SparseApplyFtrl . |
Thuộc tính công khai
hoạt động
Operation operation
ngoài
::tensorflow::Output out
Chức năng công cộng
thưa thớtÁp dụngFtrl
SparseApplyFtrl( const ::tensorflow::Scope & scope, ::tensorflow::Input var, ::tensorflow::Input accum, ::tensorflow::Input linear, ::tensorflow::Input grad, ::tensorflow::Input indices, ::tensorflow::Input lr, ::tensorflow::Input l1, ::tensorflow::Input l2, ::tensorflow::Input lr_power )
thưa thớtÁp dụngFtrl
SparseApplyFtrl( const ::tensorflow::Scope & scope, ::tensorflow::Input var, ::tensorflow::Input accum, ::tensorflow::Input linear, ::tensorflow::Input grad, ::tensorflow::Input indices, ::tensorflow::Input lr, ::tensorflow::Input l1, ::tensorflow::Input l2, ::tensorflow::Input lr_power, const SparseApplyFtrl::Attrs & attrs )