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

Add img_size for unit test

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