提交 45b8c47e 编写于 作者: L liaogang

Add img_size for unit test

上级 bd38faca
...@@ -65,9 +65,9 @@ endif() ...@@ -65,9 +65,9 @@ endif()
set(COMMON_FLAGS set(COMMON_FLAGS
-fPIC -fPIC
-fno-omit-frame-pointer -fno-omit-frame-pointer
# -Wall -Wall
# -Wextra -Wextra
# -Werror -Werror
-Wnon-virtual-dtor -Wnon-virtual-dtor
-Wdelete-non-virtual-dtor -Wdelete-non-virtual-dtor
-Wno-unused-parameter -Wno-unused-parameter
......
...@@ -23,7 +23,22 @@ REGISTER_LAYER(bilinear_interp, BilinearInterpLayer); ...@@ -23,7 +23,22 @@ REGISTER_LAYER(bilinear_interp, BilinearInterpLayer);
size_t BilinearInterpLayer::getSize() { size_t BilinearInterpLayer::getSize() {
inImgH_ = inputLayers_[0]->getOutput().getFrameHeight(); inImgH_ = inputLayers_[0]->getOutput().getFrameHeight();
inImgW_ = inputLayers_[0]->getOutput().getFrameWidth(); inImgW_ = inputLayers_[0]->getOutput().getFrameWidth();
const BilinearInterpConfig& conf = config_.inputs(0).bilinear_interp_conf();
if (inImgH_ == 0) {
inImgH_ = conf.img_size_y();
}
if (inImgW_ == 0) {
inImgW_ = conf.img_size_x();
}
outImgH_ = conf.out_size_y();
outImgW_ = conf.out_size_x();
numChannels_ = conf.num_channels();
CHECK(outImgH_ > 0 && outImgW_ > 0);
CHECK(inImgH_ > 0 && inImgW_ > 0); CHECK(inImgH_ > 0 && inImgW_ > 0);
CHECK(numChannels_);
getOutput().setFrameHeight(outImgH_); getOutput().setFrameHeight(outImgH_);
getOutput().setFrameWidth(outImgW_); getOutput().setFrameWidth(outImgW_);
...@@ -37,15 +52,6 @@ bool BilinearInterpLayer::init(const LayerMap& layerMap, ...@@ -37,15 +52,6 @@ bool BilinearInterpLayer::init(const LayerMap& layerMap,
CHECK_EQ(1, config_.inputs_size()); CHECK_EQ(1, config_.inputs_size());
const BilinearInterpConfig& conf = config_.inputs(0).bilinear_interp_conf();
outImgH_ = conf.out_size_y();
outImgW_ = conf.out_size_x();
numChannels_ = conf.num_channels();
CHECK(outImgH_ > 0 && outImgW_ > 0);
CHECK(numChannels_);
return true; return true;
} }
......
...@@ -40,6 +40,8 @@ TEST(Layer, BilinearInterpLayer) { ...@@ -40,6 +40,8 @@ TEST(Layer, BilinearInterpLayer) {
LayerInputConfig* input = config.layerConfig.add_inputs(); LayerInputConfig* input = config.layerConfig.add_inputs();
BilinearInterpConfig* bilinear = input->mutable_bilinear_interp_conf(); BilinearInterpConfig* bilinear = input->mutable_bilinear_interp_conf();
bilinear->set_img_size_x(32);
bilinear->set_img_size_y(32);
bilinear->set_out_size_x(64); bilinear->set_out_size_x(64);
bilinear->set_out_size_y(64); bilinear->set_out_size_y(64);
bilinear->set_num_channels(4); bilinear->set_num_channels(4);
......
...@@ -213,10 +213,13 @@ message OperatorConfig { ...@@ -213,10 +213,13 @@ message OperatorConfig {
} }
message BilinearInterpConfig { message BilinearInterpConfig {
// The size if output feature map. // The size of input feature map.
required uint32 out_size_x = 1; optional uint32 img_size_x = 1;
required uint32 out_size_y = 2; optional uint32 img_size_y = 2;
required uint32 num_channels = 3; // The size of output feature map.
required uint32 out_size_x = 3;
required uint32 out_size_y = 4;
required uint32 num_channels = 5;
} }
message ImageConfig { message ImageConfig {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册