Skip to content

Commit

Permalink
Merge pull request #59 from z-learner/main
Browse files Browse the repository at this point in the history
Fix typo in AdaptiveAveragePoolingLayer::check to prevent coredump in forward_average_pooling_out1x1 test
  • Loading branch information
zjhellofss authored Jun 3, 2024
2 parents 89b7907 + 3363e33 commit ac490d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/layer/details/adaptive_avgpooling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,11 @@ StatusCode AdaptiveAveragePoolingLayer::Check(const std::vector<sftensor>& input
}

for (const auto& input_data : inputs) {
if (input_data == nullptr || input_data->empty())
if (input_data == nullptr || input_data->empty()) {
LOG(ERROR) << "The input tensor array in the adaptive pooling layer has an empty "
"tensor ";
return StatusCode::kInferInputsEmpty;
return StatusCode::kInferInputsEmpty;
}
}

if (!output_h_ || !output_w_) {
Expand Down
2 changes: 2 additions & 0 deletions test/test_layer/test_average_pooling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ TEST(test_layer, forward_average_pooling_out1x1) {
for (uint32_t i = 0; i < input_size; ++i) {
const auto& output1 = outputs1.at(i);
const auto& output2 = outputs2.at(i);
ASSERT_NE(output1, nullptr);
ASSERT_NE(output2, nullptr);
ASSERT_EQ(output1->channels(), output2->channels());
ASSERT_EQ(output1->shapes(), output2->shapes());
uint32_t channels = output1->channels();
Expand Down

0 comments on commit ac490d2

Please sign in to comment.