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

Function ApplyAdagradDecayShapeFn

tensorflow/core/ops/training_ali_ops.cc:247–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245#undef REGISTER_OP_BY_NAME
246
247static Status ApplyAdagradDecayShapeFn(InferenceContext* c, bool sparse) {
248 ShapeHandle unused;
249 ShapeHandle s = ShapeOrHandleShape(c, 0); // var
250 TF_RETURN_IF_ERROR(c->Merge(s, ShapeOrHandleShape(c, 1), &s)); // accum
251 // AdagradDecayOptimizer & AdagradDecayOptimizerV2 has different shape
252 // of accum_decay_power. DO NOT check shape of input(2) here.
253 TF_RETURN_IF_ERROR(c->WithRank(c->input(3), 0, &unused)); // lr
254 TF_RETURN_IF_ERROR(c->WithRank(c->input(4), 0, &unused)); // decay_step
255 TF_RETURN_IF_ERROR(c->WithRank(c->input(5), 0, &unused)); // decay_rate
256 TF_RETURN_IF_ERROR(c->WithRank(c->input(6), 0, &unused)); // baseline
257 TF_RETURN_IF_ERROR(c->WithRank(c->input(7), 0, &unused)); // global_step
258 TF_RETURN_IF_ERROR(
259 HandleGradAndIndicesInputs(c, sparse, 8 /* grad_idx */, &s));
260 if (c->num_outputs() > 0) {
261 c->set_output(0, s);
262 }
263 return Status::OK();
264}
265
266REGISTER_OP("ApplyAdagradDecay")
267 .Input("var: Ref(T)")

Callers 1

Calls 7

ShapeOrHandleShapeFunction · 0.70
MergeMethod · 0.45
WithRankMethod · 0.45
inputMethod · 0.45
num_outputsMethod · 0.45
set_outputMethod · 0.45

Tested by

no test coverage detected