Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ __kernel void broadcast_elementwise_common(
output = fuse_scale(output, SCALE_SLOPE, SCALE_BIAS, SCALE_ALPHA);
#endif

#if defined(RELU) || defined(GELU)
#if defined(RELU) || defined(RELU6) || defined(GELU)
CL_DTYPE4 alpha;
output = activation_type4(output, alpha);
#endif
Expand Down
4 changes: 2 additions & 2 deletions lite/backends/opencl/cl_kernel/image/elementwise_kernel.cl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ __kernel void elementwise_compute(__read_only image2d_t input,
output = fuse_scale(output, SCALE_SLOPE, SCALE_BIAS, SCALE_ALPHA);
#endif

#if defined(RELU) || defined(GELU)
#if defined(RELU) || defined(RELU6) || defined(GELU)
CL_DTYPE4 alpha;
output = activation_type4(output, alpha);
#endif
Expand Down Expand Up @@ -91,7 +91,7 @@ __kernel void broadcast_elementwise_basic(
output = fuse_scale(output, SCALE_SLOPE, SCALE_BIAS, SCALE_ALPHA);
#endif

#if defined(RELU) || defined(GELU)
#if defined(RELU) || defined(RELU6) || defined(GELU)
CL_DTYPE4 alpha;
output = activation_type4(output, alpha);
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void ElementwiseActivationFusePass::Apply(

bool has_opencl = has_target(TARGET(kOpenCL));
if (has_opencl) {
act_types.push_back("relu");
act_types.push_back("relu6");
act_types.push_back("gelu");
}

Expand Down
2 changes: 2 additions & 0 deletions lite/kernels/opencl/elementwise_image_compute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class ElementwiseImageCompute : public KernelLite<TARGET(kOpenCL),
VLOG(4) << "act: " << act_t;
if (act_t == "relu") {
build_options_ += " -DRELU";
} else if (act_t == "relu6") {
build_options_ += " -DRELU6";
} else if (act_t == "gelu") {
build_options_ += " -DGELU";
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def sample_program_configs(self, draw):
target_str = self.get_target()
act_list = ['relu']
if target_str == "OpenCL":
act_list.append("relu6")
act_list.append("gelu")
act_type = draw(st.sampled_from(act_list))

Expand Down