Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix coverity defects #11759

Merged
merged 1 commit into from
Oct 25, 2023
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
1 change: 1 addition & 0 deletions onert-micro/luci-interpreter/pal/common/PALL2Pool2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ inline void L2Pool(const PoolParams &params, const luci_interpreter::RuntimeShap
filter_count++;
}
}
assert(filter_count != 0);
const float l2pool_result = std::sqrt(sum_squares / filter_count);
output_data[offset(output_shape.dimsData(), batch, out_y, out_x, channel)] =
activationFunctionWithMinMax(l2pool_result, params.float_activation_min,
Expand Down
1 change: 1 addition & 0 deletions onert-micro/luci-interpreter/src/kernels/DepthToSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ void execute_kernel_CircleDepthToSpace(const circle::Operator *cur_op,
#ifndef DIS_FLOAT
case DataType::FLOAT32:
{
assert(block_size != 0);
luci_interpreter_pal::DepthToSpace(
block_size, kernels::getTensorRuntimeShape(kernel.input(), runtime_graph),
kernels::getTensorData<float>(runtime_graph->getDataByTensor(kernel.input())),
Expand Down
4 changes: 2 additions & 2 deletions onert-micro/luci-interpreter/src/kernels/Softmax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void evalQuantize(const circle::Tensor *input, const circle::Tensor *output,

if (Tensor::element_type(input) == DataType::S16)
{
int left_shift = params.input_left_shift;
int left_shift = 0;
double input_scale_beta_rescale =
static_cast<double>(Tensor::scale(input)) * static_cast<double>(beta) /
(10.0 / 65535.0); // scale the input_diff such that [-65535, 0]
Expand All @@ -99,7 +99,7 @@ void evalQuantize(const circle::Tensor *input, const circle::Tensor *output,
}
else
{
int left_shift = params.input_left_shift;
int left_shift = 0;
preprocessSoftmaxScaling(static_cast<double>(params.beta),
static_cast<double>(Tensor::scale(input)), kScaledDiffIntegerBits,
&params.input_multiplier, &left_shift);
Expand Down
1 change: 1 addition & 0 deletions onert-micro/luci-interpreter/src/kernels/SpaceToDepth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ void execute_kernel_CircleSpaceToDepth(const circle::Operator *cur_op,
#ifndef DIS_FLOAT
case DataType::FLOAT32:
{
assert(block_size != 0);
luci_interpreter_pal::SpaceToDepth(
block_size, kernels::getTensorRuntimeShape(kernel.input(), runtime_graph),
kernels::getTensorData<float>(runtime_graph->getDataByTensor(kernel.input())),
Expand Down