提交 48173e85 编写于 作者: T Tao Luo 提交者: GitHub

Merge pull request #5010 from tensor-tang/merge

fix crash on ds2
...@@ -339,9 +339,13 @@ private: ...@@ -339,9 +339,13 @@ private:
* clear all grad * clear all grad
*/ */
void clearGrads() { void clearGrads() {
output_.grad->zeroMem(); if (output_.grad) {
output_.grad->zeroMem();
}
for (size_t i = 0; i < outputOtherDevice_.size(); i++) { for (size_t i = 0; i < outputOtherDevice_.size(); i++) {
outputOtherDevice_[i].grad->zeroMem(); if (outputOtherDevice_[i].grad) {
outputOtherDevice_[i].grad->zeroMem();
}
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册