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

Method AddGradients

tensorflow/c/c_api_test.cc:1608–1623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1606 }
1607
1608 void AddGradients(bool grad_inputs_provided, const char* prefix,
1609 TF_Output* inputs, int ninputs, TF_Output* outputs,
1610 int noutputs, TF_Output* grad_outputs) {
1611 if (grad_inputs_provided) {
1612 TF_Output grad_inputs[1];
1613 const float grad_inputs_val[] = {1.0, 1.0, 1.0, 1.0};
1614 TF_Operation* grad_inputs_op =
1615 FloatConst2x2(graph_, s_, grad_inputs_val, "GradInputs");
1616 grad_inputs[0] = TF_Output{grad_inputs_op, 0};
1617 TF_AddGradientsWithPrefix(graph_, prefix, outputs, noutputs, inputs,
1618 ninputs, grad_inputs, s_, grad_outputs);
1619 } else {
1620 TF_AddGradientsWithPrefix(graph_, prefix, outputs, noutputs, inputs,
1621 ninputs, nullptr, s_, grad_outputs);
1622 }
1623 }
1624
1625 void BuildErrorGraph(TF_Output* inputs, TF_Output* outputs) {
1626 const float const0_val[] = {1.0, 2.0, 3.0, 4.0};

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected