MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Momentum

Function Momentum

tensorflow/core/kernels/training_ops_test.cc:188–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186 ->ArgPair(128, 128 << 10);
187
188static void Momentum(int32 n, Graph** init_g, Graph** train_g) {
189 TensorShape shape({n});
190 {
191 Graph* g = new Graph(OpRegistry::Global());
192 auto var = Var(g, n);
193 auto accum = Var(g, n);
194 auto zero = Zeros(g, n);
195 test::graph::Assign(g, var, zero);
196 test::graph::Assign(g, accum, zero);
197 *init_g = g;
198 }
199 {
200 Graph* g = new Graph(OpRegistry::Global());
201 auto var = Var(g, n);
202 auto accum = Var(g, n);
203 auto lr = Scalar(g, 0.01);
204 auto grad = Random(g, n);
205 auto mom = Scalar(g, 0.01);
206 test::graph::Multi(g, "ApplyMomentum", {var, accum, lr, grad, mom});
207 *train_g = g;
208 }
209}
210
211static void BM_Momentum(int iters, int params) {
212 const int64 tot = static_cast<int64>(iters) * params;

Callers 1

BM_MomentumFunction · 0.85

Calls 6

ScalarFunction · 0.85
RandomFunction · 0.85
MultiFunction · 0.85
VarFunction · 0.70
ZerosFunction · 0.70
AssignClass · 0.70

Tested by

no test coverage detected