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

fix crash on ds2

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