提交 386bb1fe 编写于 作者: T tensor-tang

fix crash on ds2

上级 abce9eb7
...@@ -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.
先完成此消息的编辑!
想要评论请 注册