提交 1ec66a33 编写于 作者: G gaoyuan

change resizeOrCreate to create

上级 25a525bb
...@@ -206,17 +206,14 @@ bool SmoothL1CostLayer::init(const LayerMap& layerMap, ...@@ -206,17 +206,14 @@ bool SmoothL1CostLayer::init(const LayerMap& layerMap,
void SmoothL1CostLayer::forwardImp(Matrix& output, void SmoothL1CostLayer::forwardImp(Matrix& output,
Argument& label, Argument& label,
Matrix& target) { Matrix& target) {
MatrixPtr targetCpu, labelCpu, outputCpu; MatrixPtr targetCpu, outputCpu, labelCpu;
if (useGpu_) { if (useGpu_) {
Matrix::resizeOrCreate( targetCpu =
targetCpu, target.getHeight(), target.getWidth(), false, false); Matrix::create(target.getHeight(), target.getWidth(), false, false);
Matrix::resizeOrCreate( outputCpu =
outputCpu, output.getHeight(), output.getWidth(), false, false); Matrix::create(output.getHeight(), output.getWidth(), false, false);
Matrix::resizeOrCreate(labelCpu, labelCpu = Matrix::create(
label.value->getHeight(), label.value->getHeight(), label.value->getWidth(), false, false);
label.value->getWidth(),
false,
false);
targetCpu->copyFrom(target); targetCpu->copyFrom(target);
outputCpu->copyFrom(output); outputCpu->copyFrom(output);
labelCpu->copyFrom(*label.value); labelCpu->copyFrom(*label.value);
...@@ -230,17 +227,14 @@ void SmoothL1CostLayer::forwardImp(Matrix& output, ...@@ -230,17 +227,14 @@ void SmoothL1CostLayer::forwardImp(Matrix& output,
void SmoothL1CostLayer::backwardImp(Matrix& output, void SmoothL1CostLayer::backwardImp(Matrix& output,
Argument& label, Argument& label,
Matrix& outputG) { Matrix& outputG) {
MatrixPtr outputGCpu, labelCpu, outputCpu; MatrixPtr outputGCpu, outputCpu, labelCpu;
if (useGpu_) { if (useGpu_) {
Matrix::resizeOrCreate( outputGCpu =
outputGCpu, outputG.getHeight(), outputG.getWidth(), false, false); Matrix::create(outputG.getHeight(), outputG.getWidth(), false, false);
Matrix::resizeOrCreate( outputCpu =
outputCpu, output.getHeight(), output.getWidth(), false, false); Matrix::create(output.getHeight(), output.getWidth(), false, false);
Matrix::resizeOrCreate(labelCpu, labelCpu = Matrix::create(
label.value->getHeight(), label.value->getHeight(), label.value->getWidth(), false, false);
label.value->getWidth(),
false,
false);
outputGCpu->copyFrom(outputG); outputGCpu->copyFrom(outputG);
outputCpu->copyFrom(output); outputCpu->copyFrom(output);
labelCpu->copyFrom(*label.value); labelCpu->copyFrom(*label.value);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册