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

Merge pull request #5010 from tensor-tang/merge

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