提交 2c05abda 编写于 作者: Y Yuan Shuai 提交者: GitHub

[LITE][DEMO] Fix mobile light demo (#3180)

* [LITE][OPENCL] Change fp32 fc to fp16's. test=develop

* fix act in conv3x3opt opencl kernel. test=develop

* [LITE][DEMO] fix input arg. test=develop

* fix shutdownlog for std::endl. test=develop
上级 ccd0c558
......@@ -14,23 +14,23 @@ limitations under the License. */
#include <cl_common.h>
__kernel void conv2d_3x3(__private const int item_ch,
__private const int item_w,
__private const int item_h,
__read_only image2d_t input_image,
__read_only image2d_t filter_image,
__kernel void conv2d_3x3_opt(__private const int item_ch,
__private const int item_w,
__private const int item_h,
__read_only image2d_t input_image,
__read_only image2d_t filter_image,
#if defined(BIASE_CH) || defined(BIASE_ELE)
__read_only image2d_t bias,
__read_only image2d_t bias,
#endif
__write_only image2d_t output_image,
__private const int stride,
__private const int pad,
__private const int dilation,
__private const int in_ch,
__private const int in_w,
__private const int in_h,
__private const int out_w,
__private const int out_h) {
__write_only image2d_t output_image,
__private const int stride,
__private const int pad,
__private const int dilation,
__private const int in_ch,
__private const int in_w,
__private const int in_h,
__private const int out_w,
__private const int out_h) {
const sampler_t sampler =
CLK_NORMALIZED_COORDS_TRUE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
......
......@@ -31,7 +31,7 @@ int64_t ShapeProduction(const shape_t& shape) {
std::string ShapePrint(const shape_t& shape) {
std::string shape_str{""};
for (auto i : shape) {
shape_str = shape_str + std::to_string(i) + " ";
shape_str += std::to_string(i) + " ";
}
return shape_str;
}
......@@ -153,9 +153,9 @@ int main(int argc, char** argv) {
std::string model_dir = argv[1];
if (argc >= 9) {
input_shape[0] = atoi(argv[2]);
input_shape[1] = atoi(argv[4]);
input_shape[2] = atoi(argv[5]);
input_shape[3] = atoi(argv[6]);
input_shape[1] = atoi(argv[3]);
input_shape[2] = atoi(argv[4]);
input_shape[3] = atoi(argv[5]);
repeats = atoi(argv[6]);
warmup = atoi(argv[7]);
print_output_elem = atoi(argv[8]);
......
......@@ -98,7 +98,7 @@ void ConvImageCompute::PrepareForRun() {
filter_image_dims[0], filter_image_dims[1], filter_image_v.data());
impl_ = &ConvImageCompute::Conv2d1x1;
// # define DEPTH_CONV_USE_SPL
// #define DEPTH_CONV_USE_SPL
#ifdef DEPTH_CONV_USE_SPL
} else if (filter_dims[1] == 1 && x_dims[1] == output_dims[1] &&
kernel_h == 3 && kernel_w == 3 && groups > 1) {
......@@ -142,7 +142,7 @@ void ConvImageCompute::PrepareForRun() {
impl_ = &ConvImageCompute::DepthwiseConv2d;
} else if (kernel_h == 3 && kernel_h == 3) {
// conv2d_3x3
kernel_func_names_.push_back("conv2d_3x3");
kernel_func_names_.push_back("conv2d_3x3_opt");
kernel_func_paths_.push_back("image/conv2d_3x3_opt_kernel.cl");
CLImageConverterFolder converter;
......
......@@ -87,7 +87,7 @@ void elementwise_compute_ref(const dtype *x_data,
}
}
} else {
LOG(FATAL) << "unsupported Elementwise type: " << elt_type << std::endl;
LOG(FATAL) << "unsupported Elementwise type: " << elt_type;
}
}
......
......@@ -87,7 +87,7 @@ void elementwise_compute_ref(const dtype *x_data,
}
}
} else {
LOG(FATAL) << "unsupported Elementwise type: " << elt_type << std::endl;
LOG(FATAL) << "unsupported Elementwise type: " << elt_type;
}
}
......
......@@ -106,7 +106,7 @@ void elementwise_compute_ref(const dtype *x_data,
out_data[x] = x_data[x] * y_data[y];
}
} else {
LOG(FATAL) << "unsupported Elementwise type: " << elt_type << std::endl;
LOG(FATAL) << "unsupported Elementwise type: " << elt_type;
}
}
......
......@@ -87,7 +87,7 @@ void elementwise_compute_ref(const dtype *x_data,
}
}
} else {
LOG(FATAL) << "unsupported Elementwise type: " << elt_type << std::endl;
LOG(FATAL) << "unsupported Elementwise type: " << elt_type;
}
}
......
......@@ -224,7 +224,7 @@ TEST(grid_samler_image2d, compute) {
#ifdef GRID_FP16_PRINT_RESULT
LOG(INFO) << "---- print kernel result (input -> output) ----";
for (int eidx = 0; eidx < in_dim.production(); ++eidx) {
std::cout << input_v[eidx] << " -> " << out_data[eidx] << std::endl;
std::cout << input_v[eidx] << " -> " << out_data[eidx] << "\n";
}
#endif // GRID_FP16_PRINT_RESULT
for (int i = 0; i < out_dim.production(); i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册