Skip to content

Commit 48ea047

Browse files
committed
Bug fix in testing mode.
1 parent b87427b commit 48ea047

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

paddle/gserver/layers/ConcatenateLayer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ void ConcatenateLayer2::forward(PassType passType) {
160160
size_t startCol = projCol_[i].first;
161161
size_t endCol = projCol_[i].second;
162162
projOutput_[i].value = output_.value->subColMatrix(startCol, endCol);
163-
projOutput_[i].grad = output_.grad->subColMatrix(startCol, endCol);
163+
if (output_.grad) {
164+
projOutput_[i].grad = output_.grad->subColMatrix(startCol, endCol);
165+
}
164166
}
165167

166168
{

paddle/gserver/layers/SpatialPyramidPoolLayer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ void SpatialPyramidPoolLayer::forward(PassType passType) {
112112
size_t startCol = projCol_[i].first;
113113
size_t endCol = projCol_[i].second;
114114
projOutput_[i].value = output_.value->subColMatrix(startCol, endCol);
115-
projOutput_[i].grad = output_.grad->subColMatrix(startCol, endCol);
115+
if (output_.grad) {
116+
projOutput_[i].grad = output_.grad->subColMatrix(startCol, endCol);
117+
}
116118
}
117119
for (size_t i = 0; i < pyramidHeight_; i++) {
118120
poolProjections_[i]->forward(&getInput(0), &projOutput_[i], passType);

0 commit comments

Comments
 (0)