تدفق التوتر:: العمليات:: تطبيق الزخم
#include <training_ops.h>
قم بتحديث '*var' وفقًا لمخطط الزخم.
ملخص
اضبط use_nesterov = True إذا كنت تريد استخدام زخم Nesterov.
تراكم = تراكم * الزخم + غراد var -= lr * تراكم
الحجج:
- النطاق: كائن النطاق
- فار: يجب أن يكون من متغير ().
- تراكم: يجب أن يكون من متغير ().
- lr: عامل التحجيم. يجب أن يكون العددية.
- غراد: التدرج.
- الزخم : الزخم . يجب أن يكون العددية.
السمات الاختيارية (انظر Attrs
):
- use_locking: إذا كان
True
، فسيتم حماية تحديث موترتي var وaccum بواسطة قفل؛ وإلا فإن السلوك غير محدد، ولكنه قد يحمل قدرًا أقل من الخلاف. - use_nesterov: إذا كان
True
، فإن الموتر الذي تم تمريره لحساب الدرجة سيكون var - lr * Momentum * accum، لذا في النهاية، فإن var الذي تحصل عليه هو في الواقع var - lr * Momentum * accum.
العوائد:
-
Output
: نفس "فار".
البنائين والمدمرين | |
---|---|
ApplyMomentum (const :: tensorflow::Scope & scope, :: tensorflow::Input var, :: tensorflow::Input accum, :: tensorflow::Input lr, :: tensorflow::Input grad, :: tensorflow::Input momentum) | |
ApplyMomentum (const :: tensorflow::Scope & scope, :: tensorflow::Input var, :: tensorflow::Input accum, :: tensorflow::Input lr, :: tensorflow::Input grad, :: tensorflow::Input momentum, const ApplyMomentum::Attrs & attrs) |
الوظائف العامة | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
وظائف ثابتة العامة | |
---|---|
UseLocking (bool x) | |
UseNesterov (bool x) |
الهياكل | |
---|---|
Tensorflow:: ops:: ApplyMomentum:: Attrs | محددات السمات الاختيارية لـ ApplyMomentum . |
الصفات العامة
عملية
Operation operation
خارج
::tensorflow::Output out
الوظائف العامة
تطبيق الزخم
ApplyMomentum(
const ::tensorflow::Scope & scope,
::tensorflow::Input var,
::tensorflow::Input accum,
::tensorflow::Input lr,
::tensorflow::Input grad,
::tensorflow::Input momentum
)
تطبيق الزخم
ApplyMomentum(
const ::tensorflow::Scope & scope,
::tensorflow::Input var,
::tensorflow::Input accum,
::tensorflow::Input lr,
::tensorflow::Input grad,
::tensorflow::Input momentum,
const ApplyMomentum::Attrs & attrs
)