-
Notifications
You must be signed in to change notification settings - Fork 5.9k
add sparse support for sum op #5093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
paddle/framework/executor.cc
Outdated
} | ||
} | ||
|
||
void CreateTensor(Variable* var, VarDesc::VarType var_type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static void CreateTensor()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
paddle/framework/selected_rows.h
Outdated
|
||
const Vector<int64_t>& rows() const { return rows_; } | ||
|
||
Vector<int64_t>& mutable_rows() { return rows_; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vector<int64_t>* mutable_rows()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
}; | ||
|
||
template struct SelectedRowsAddTo<platform::CPUPlace, float>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add double
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
out->Resize(in_vars[i]->Get<framework::LoDTensor>().dims()); | ||
break; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
39-44 lines are not necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
Fix #5094
This PR depends on #5027
Because current operator backward tests are still based on run-time, not compile-time, we can not set correct Variable type in backward process.
I comment check_grad of test_sum_op for an example. test_word2vec and test_sum_op can pass ci test.