提交 520342ed 编写于 作者: G gaoyuan

Fix code format

上级 707a9c9b
...@@ -13,8 +13,8 @@ See the License for the specific language governing permissions and ...@@ -13,8 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#include "Layer.h" #include "Layer.h"
#include "paddle/math/Matrix.h"
#include "paddle/math/BaseMatrix.h" #include "paddle/math/BaseMatrix.h"
#include "paddle/math/Matrix.h"
namespace paddle { namespace paddle {
/** /**
...@@ -100,6 +100,8 @@ void PriorBoxLayer::forward(PassType passType) { ...@@ -100,6 +100,8 @@ void PriorBoxLayer::forward(PassType passType) {
tmpPtr[idx++] = (centerY - boxHeight / 2.) / imageHeight; tmpPtr[idx++] = (centerY - boxHeight / 2.) / imageHeight;
tmpPtr[idx++] = (centerX + boxWidth / 2.) / imageWidth; tmpPtr[idx++] = (centerX + boxWidth / 2.) / imageWidth;
tmpPtr[idx++] = (centerY + boxHeight / 2.) / imageHeight; tmpPtr[idx++] = (centerY + boxHeight / 2.) / imageHeight;
// set the variance.
for (int t = 0; t < 4; t++) tmpPtr[idx++] = variance_[t];
if (maxSize_.size() > 0) { if (maxSize_.size() > 0) {
CHECK_EQ(minSize_.size(), maxSize_.size()); CHECK_EQ(minSize_.size(), maxSize_.size());
...@@ -111,6 +113,8 @@ void PriorBoxLayer::forward(PassType passType) { ...@@ -111,6 +113,8 @@ void PriorBoxLayer::forward(PassType passType) {
tmpPtr[idx++] = (centerY - boxHeight / 2.) / imageHeight; tmpPtr[idx++] = (centerY - boxHeight / 2.) / imageHeight;
tmpPtr[idx++] = (centerX + boxWidth / 2.) / imageWidth; tmpPtr[idx++] = (centerX + boxWidth / 2.) / imageWidth;
tmpPtr[idx++] = (centerY + boxHeight / 2.) / imageHeight; tmpPtr[idx++] = (centerY + boxHeight / 2.) / imageHeight;
// set the variance.
for (int t = 0; t < 4; t++) tmpPtr[idx++] = variance_[t];
} }
} }
} }
...@@ -124,17 +128,15 @@ void PriorBoxLayer::forward(PassType passType) { ...@@ -124,17 +128,15 @@ void PriorBoxLayer::forward(PassType passType) {
tmpPtr[idx++] = (centerY - boxHeight / 2.) / imageHeight; tmpPtr[idx++] = (centerY - boxHeight / 2.) / imageHeight;
tmpPtr[idx++] = (centerX + boxWidth / 2.) / imageWidth; tmpPtr[idx++] = (centerX + boxWidth / 2.) / imageWidth;
tmpPtr[idx++] = (centerY + boxHeight / 2.) / imageHeight; tmpPtr[idx++] = (centerY + boxHeight / 2.) / imageHeight;
// set the variance.
for (int t = 0; t < 4; t++) tmpPtr[idx++] = variance_[t];
} }
} }
} }
// clip the prior's coordidate such that it is within [0, 1] // clip the prior's coordidate such that it is within [0, 1]
for (int d = 0; d < dim; ++d) for (int d = 0; d < dim * 2; ++d)
if ((d % 8) < 4)
tmpPtr[d] = std::min(std::max(tmpPtr[d], (float)0.), (float)1.); tmpPtr[d] = std::min(std::max(tmpPtr[d], (float)0.), (float)1.);
// set the variance.
for (int h = 0; h < layerHeight; h++)
for (int w = 0; w < layerWidth; w++)
for (int i = 0; i < numPriors_; i++)
for (int j = 0; j < 4; j++) tmpPtr[idx++] = variance_[j];
MatrixPtr outV = getOutputValue(); MatrixPtr outV = getOutputValue();
outV->copyFrom(buffer_->data_, dim * 2); outV->copyFrom(buffer_->data_, dim * 2);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册