提交 53946283 编写于 作者: P peterzhang2029

bug fix when using hsigmoid with gpu

上级 cda3a774
......@@ -129,8 +129,7 @@ void HierarchicalSigmoidLayer::forward(PassType passType) {
*cpuOutput_,
-1); // scaleSum
preOutput_.value->softrelu(*preOutput_.value);
MatrixPtr sum =
Matrix::create(batchSize, 1, /* trans= */ false, false);
MatrixPtr sum = Matrix::create(batchSize, 1, /* trans= */ false, false);
preOutput_.value->rowSum(*sum);
cpuOutput_->add(*sum);
if (useGpu_) {
......@@ -164,8 +163,7 @@ void HierarchicalSigmoidLayer::backward(const UpdateCallback& callback) {
} else {
cpuBias_ = biases_grad;
}
preOutput_.grad->addByBitCodeBackward(
numClasses_, *cpuLabel_, *cpuBias_);
preOutput_.grad->addByBitCodeBackward(numClasses_, *cpuLabel_, *cpuBias_);
if (useGpu) {
biases_grad->copyFrom(*cpuBias_);
} else {
......
......@@ -89,7 +89,6 @@ protected:
MatrixPtr cpuBias_;
MatrixPtr cpuOutput_;
IVectorPtr cpuLabel_;
};
} // namespace paddle
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册