未验证 提交 e43081ff 编写于 作者: H huzhiqiang 提交者: GitHub

[CI][Opt]Check the usability of opt in CI project (#3820)

上级 69f9cea0
...@@ -236,19 +236,19 @@ void test_conv_fp32(const std::vector<DDim>& input_dims, ...@@ -236,19 +236,19 @@ void test_conv_fp32(const std::vector<DDim>& input_dims,
double gops = 2.0 * dim_out.production() * dim_in[1] * weight_dim[2] * double gops = 2.0 * dim_out.production() * dim_in[1] * weight_dim[2] *
weight_dim[3] / param.groups; weight_dim[3] / param.groups;
LOG(INFO) << "conv fp32: input shape: " << dim_in << ", output shape" VLOG(4) << "conv fp32: input shape: " << dim_in << ", output shape"
<< dim_out << ",running time, avg: " << t0.LapTimes().Avg() << dim_out << ",running time, avg: " << t0.LapTimes().Avg()
<< ", min time: " << t0.LapTimes().Min() << ", min time: " << t0.LapTimes().Min()
<< ", total GOPS: " << 1e-9 * gops << ", total GOPS: " << 1e-9 * gops
<< " GOPS, avg GOPs: " << 1e-6 * gops / t0.LapTimes().Avg() << " GOPS, avg GOPs: " << 1e-6 * gops / t0.LapTimes().Avg()
<< " GOPs, max GOPs: " << 1e-6 * gops / t0.LapTimes().Min(); << " GOPs, max GOPs: " << 1e-6 * gops / t0.LapTimes().Min();
if (FLAGS_check_result) { if (FLAGS_check_result) {
double max_ratio = 0; double max_ratio = 0;
double max_diff = 0; double max_diff = 0;
tensor_cmp_host(tout_basic, *param.output, max_ratio, max_diff); tensor_cmp_host(tout_basic, *param.output, max_ratio, max_diff);
LOG(INFO) << "compare result, max diff: " << max_diff VLOG(4) << "compare result, max diff: " << max_diff
<< ", max ratio: " << max_ratio; << ", max ratio: " << max_ratio;
if (std::abs(max_ratio) > 1e-3f) { if (std::abs(max_ratio) > 1e-3f) {
if (max_diff > 5e-4f) { if (max_diff > 5e-4f) {
LOG(WARNING) << "basic result"; LOG(WARNING) << "basic result";
...@@ -274,15 +274,15 @@ void test_conv_fp32(const std::vector<DDim>& input_dims, ...@@ -274,15 +274,15 @@ void test_conv_fp32(const std::vector<DDim>& input_dims,
} }
} }
} }
LOG(INFO) << "test fp32 conv: input: " << dim_in VLOG(4) << "test fp32 conv: input: " << dim_in
<< ", output: " << dim_out << ", weight dim: " << weight_dim << ", output: " << dim_out << ", weight dim: " << weight_dim
<< ", pad: " << pads[0] << ", " << pads[1] << ", " << pads[2] << ", pad: " << pads[0] << ", " << pads[1] << ", " << pads[2]
<< ", " << pads[3] << ", stride: " << strides[0] << ", " << ", " << pads[3] << ", stride: " << strides[0] << ", "
<< strides[1] << ", dila_: " << dilas[0] << ", " << dilas[1] << strides[1] << ", dila_: " << dilas[0] << ", " << dilas[1]
<< ", group: " << group << ", group: " << group
<< ", bias: " << (flag_bias ? "true" : "false") << ", bias: " << (flag_bias ? "true" : "false")
<< ", act: " << flag_act << ", threads: " << th << ", act: " << flag_act << ", threads: " << th
<< ", power_mode: " << cls << " successed!!\n"; << ", power_mode: " << cls << " successed!!\n";
} }
} }
} }
......
...@@ -564,8 +564,18 @@ function test_arm_model { ...@@ -564,8 +564,18 @@ function test_arm_model {
function test_model_optimize_tool_compile { function test_model_optimize_tool_compile {
cd $workspace cd $workspace
cd build cd build
# Compile opt tool
cmake .. -DWITH_LITE=ON -DLITE_ON_MODEL_OPTIMIZE_TOOL=ON -DWITH_TESTING=OFF -DLITE_BUILD_EXTRA=ON cmake .. -DWITH_LITE=ON -DLITE_ON_MODEL_OPTIMIZE_TOOL=ON -DWITH_TESTING=OFF -DLITE_BUILD_EXTRA=ON
make opt -j$NUM_CORES_FOR_COMPILE make opt -j$NUM_CORES_FOR_COMPILE
# Check whether opt can transform quantized mobilenetv1 successfully.
cd lite/api && chmod +x ./opt
wget --no-check-certificate https://paddlelite-data.bj.bcebos.com/doc_models/MobileNetV1_quant.tar.gz
tar zxf MobileNetV1_quant.tar.gz
./opt --model_dir=./MobileNetV1_quant --valid_targets=arm --optimize_out=quant_mobilenetv1
if [ ! -f quant_mobilenetv1.nb ]; then
echo -e "Error! Resulted opt can not tramsform MobileNetV1_quant successfully!"
exit 1
fi
} }
function _test_paddle_code_generator { function _test_paddle_code_generator {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册