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

Function AddWhileLoopGradient

tensorflow/cc/framework/while_gradients.cc:179–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177} // namespace
178
179Status AddWhileLoopGradient(WhileContext* while_ctx, const Scope& scope,
180 const std::vector<Output>& grad_inputs,
181 std::vector<Output>* grad_outputs) {
182 Output forward_loop_count;
183 TF_RETURN_IF_ERROR(AddForwardLoopCounter(
184 while_ctx, scope.NewSubScope("ForwardLoopCounter"), &forward_loop_count));
185
186 // TODO(skyewm): can we combine the backprop loop counter and main gradient
187 // loop into a single loop? The original Python code doesn't combine the
188 // loops, but I'm not sure why.
189 Output backprop_counter_cond;
190 TF_RETURN_IF_ERROR(AddBackPropLoopCounter(
191 while_ctx, forward_loop_count, scope.NewSubScope("BackPropLoopCounter"),
192 &backprop_counter_cond));
193
194 return AddWhileGradientLoop(while_ctx, grad_inputs, backprop_counter_cond,
195 scope, grad_outputs);
196}
197
198} // namespace tensorflow

Callers 1

ProcessWhileLoopMethod · 0.85

Calls 4

AddForwardLoopCounterFunction · 0.85
AddBackPropLoopCounterFunction · 0.85
AddWhileGradientLoopFunction · 0.85
NewSubScopeMethod · 0.80

Tested by

no test coverage detected