Skip to content

Commit c2de5cf

Browse files
committed
dnn: force floating point literals to be float.
In OpenCL code in activations.cl, make the type of floating point literals to be float. Otherwise the values will be interpreted as doubles, causing Beignet to have type conversion issues.
1 parent d34eec3 commit c2de5cf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/dnn/src/opencl/activations.cl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ __kernel void TanHForward(const int count, __global T* in, __global T* out) {
2121
__kernel void SigmoidForward(const int count, __global const T* in, __global T* out) {
2222
int index = get_global_id(0);
2323
if(index < count)
24-
out[index] = 1. / (1. + exp(-in[index]));
24+
out[index] = 1.0f / (1.0f + exp(-in[index]));
2525
}
2626

2727
__kernel void BNLLForward(const int n, __global const T* in, __global T* out) {
2828
int index = get_global_id(0);
2929
if (index < n) {
30-
out[index] = in[index] > 0 ? in[index] + log(1. + exp(-in[index])) : log(1. + exp(in[index]));
30+
out[index] = in[index] > 0 ? in[index] + log(1.0f + exp(-in[index])) : log(1.0f + exp(in[index]));
3131
}
3232
}
3333

@@ -41,4 +41,4 @@ __kernel void PowForward(const int n, __global const T* in, __global T* out, con
4141
int index = get_global_id(0);
4242
if (index < n)
4343
out[index] = pow(shift + scale * in[index], power);
44-
}
44+
}

0 commit comments

Comments
 (0)