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

Method AddGradientDefHelper

tensorflow/core/framework/function.cc:1210–1227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1208}
1209
1210Status FunctionLibraryDefinition::AddGradientDefHelper(const GradientDef& grad,
1211 bool* added) {
1212 *added = false;
1213 string* entry = &func_grad_[grad.function_name()];
1214 if (!entry->empty()) {
1215 if (*entry != grad.gradient_func()) {
1216 return errors::InvalidArgument(
1217 "Cannot assign gradient function '", grad.gradient_func(), "' to '",
1218 grad.function_name(), "' because it already has gradient function ",
1219 "'", *entry, "'");
1220 }
1221 // Ignore duplicate GradientDefs
1222 return Status::OK();
1223 }
1224 *entry = grad.gradient_func();
1225 *added = true;
1226 return Status::OK();
1227}
1228
1229Status FunctionLibraryDefinition::AddLibrary(
1230 const FunctionLibraryDefinition& other) {

Callers

nothing calls this directly

Calls 3

InvalidArgumentFunction · 0.85
function_nameMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected