Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pengwa committed Jul 4, 2024
1 parent e2a5703 commit 8282c0f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion orttraining/orttraining/core/graph/gradient_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1795,12 +1795,17 @@ IMPLEMENT_GRADIENT_BUILDER(GetExternalGradient) {

std::vector<ArgDef> output_args;
for (size_t output_index = 0; output_index < node_def.outputs.size(); ++output_index) {
const auto& output = node_def.outputs[output_index];
if (output_index >= GetSrcNodeInputSize()) {
continue;
}

if (!IsGradientRequiredForSrcNodeInput(output_index)) {
output_args.emplace_back(ArgDef());
continue;
}

const auto& output = node_def.outputs[output_index];

if (output.find("GI(") == 0) {
size_t index = static_cast<size_t>(std::stoi(output.substr(3, output.length() - 4)));
output_args.emplace_back(GI(index));
Expand Down

0 comments on commit 8282c0f

Please sign in to comment.