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

Function SGD

tensorflow/core/kernels/training_ops_test.cc:89–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89static void SGD(int32 n, Graph** init_g, Graph** train_g) {
90 {
91 Graph* g = new Graph(OpRegistry::Global());
92 auto var = Var(g, n);
93 test::graph::Assign(g, var, Zeros(g, n));
94 *init_g = g;
95 }
96 {
97 Graph* g = new Graph(OpRegistry::Global());
98 auto var = Var(g, n);
99 auto lr = Scalar(g, 0.01);
100 auto grad = Random(g, n);
101 test::graph::Multi(g, "ApplyGradientDescent", {var, lr, grad});
102 *train_g = g;
103 }
104}
105
106static void BM_SGD(int iters, int params) {
107 const int64 tot = static_cast<int64>(iters) * params;

Callers 1

BM_SGDFunction · 0.70

Calls 6

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

Tested by

no test coverage detected