There is a problem in operating floating-point data in K210's IOMEM.

pull/107/head
xiangbingj 2019-11-19 22:28:38 +08:00
parent 1e5f460dfd
commit 4e53f2abf4
2 changed files with 16 additions and 1 deletions

11
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"files.associations": {
"util.h": "c",
"iomem.h": "c",
"utils.h": "c",
"sysctl.h": "c",
"printf.h": "c",
"nncase.h": "c",
"*.def": "cpp"
}
}

View File

@ -42,8 +42,12 @@ namespace kernels
const auto in_a_off = kernels::details::get_reduced_offset(in_off, in_a_shape);
const auto in_b_off = kernels::details::get_reduced_offset(in_off, in_b_shape);
const auto a = input_a[offset(in_a_shape, in_a_off)];
#if FIX_CACHE
float b;
memcpy(&b, &input_b[offset(in_b_shape, in_b_off)], sizeof(float));
#else
const auto b = input_b[offset(in_b_shape, in_b_off)];
#endif
output[offset(out_shape, in_off)] = kernels::details::apply_activation(op(a, b), fused_activation);
}
}