forked from mindspore-Ecosystem/mindspore
fix the type problem of gather.c & int8/arithmetic.c
This commit is contained in:
parent
b69f492f25
commit
f9e06d1d18
|
@ -9,7 +9,7 @@ __kernel void gather(__write_only image2d_t dst_data, __read_only image2d_t src_
|
|||
if (X >= dst_size.x || Y >= dst_size.y * dst_size.w || Z >= dst_size.z || dst_size.y == 0) {
|
||||
return;
|
||||
}
|
||||
DTYPE4 res_data = (DTYPE4)(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
DTYPE4 res_data = (DTYPE4)(0, 0, 0, 0);
|
||||
int batch = Y / dst_size.y;
|
||||
int height = Y % dst_size.y;
|
||||
if (axis == 0) {
|
||||
|
@ -23,7 +23,7 @@ __kernel void gather(__write_only image2d_t dst_data, __read_only image2d_t src_
|
|||
DTYPE tmp[4];
|
||||
DTYPE res_tmp[4];
|
||||
for (int i = 0; i < indices_num; ++i) {
|
||||
DTYPE4 rd_data = (DTYPE4)(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
DTYPE4 rd_data = (DTYPE4)(0, 0, 0, 0);
|
||||
rd_data = READ_IMAGE(src_data, smp_zero, (int2)(X * src_size.z + offset[i], batch * src_size.y + height));
|
||||
if (i >= 1 && offset[i] != offset[i - 1]) {
|
||||
rd_data = READ_IMAGE(src_data, smp_zero, (int2)(X * src_size.z + offset[i], batch * src_size.y + height));
|
||||
|
|
|
@ -14,6 +14,6 @@ __kernel void ElementAddInt8(__read_only image2d_t input_a, __read_only image2d_
|
|||
float4 real_a = convert_float4(a - zero_point.x) * scale.x;
|
||||
float4 real_b = convert_float4(b - zero_point.y) * scale.y;
|
||||
int4 result = convert_int4(round((real_a + real_b) / scale.z)) + zero_point.z;
|
||||
result = clamp(result, (FLT)(act_min), (FLT)(act_max));
|
||||
result = clamp(result, (int)(act_min), (int)(act_max));
|
||||
write_imagei(output, (int2)(X, Y), result);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue