mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
Log warning when GetGradientForOp() silently fails. (#6586)
* Add warning when GetGradientForOp() silently fails. In some cases, `GetGradientForOp()` can return without creating any nodes, which may lead to an invalid graph being created.
This commit is contained in:
parent
b09bfc8611
commit
88d48063fa
1 changed files with 5 additions and 1 deletions
|
|
@ -211,7 +211,11 @@ Status GradientGraphBuilder::Build(const std::unordered_set<std::string>* p_init
|
|||
}
|
||||
|
||||
GradientDef node_defs = GetGradientForOp(gradient_graph_config_, graph_, node, output_args_need_grad, input_args_need_grad, logger_);
|
||||
|
||||
if (node_defs.empty()) {
|
||||
LOGS(logger_, WARNING) << "GetGradientForOp() did not create any nodes for node "
|
||||
<< node->Name() << " of type " << node->OpType() << ".";
|
||||
}
|
||||
|
||||
// updates arg name if gradient accumulation is needed
|
||||
for (auto& op_def : node_defs) {
|
||||
for (auto& arg : op_def.output_args) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue