Skip to content

Commit

Permalink
[bug] fix coverity issues
Browse files Browse the repository at this point in the history
 - Specify the lambda return type to avoid object copy

Signed-off-by: hyeonseok lee <[email protected]>
  • Loading branch information
lhs8928 authored and myungjoo committed Jan 31, 2024
1 parent c13ad9b commit e93fc05
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion nnstreamer/tensor_trainer/tensor_trainer_nntrainer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,13 @@ void NNTrainer::TensorsQueue::push(const GstTensorMemory *input) {

void NNTrainer::TensorsQueue::pop(float **input, float **label, bool *last) {
ml_logd("<called>");
ml_logd("(pop/push: %d/%d)", pop_count, push_count);

pid_t pid = getpid();
pid_t tid = syscall(SYS_gettid);
ml_logd("pid[%d], tid[%d]", pid, tid);

std::unique_lock<std::mutex> lock(queue_lock);
ml_logd("(pop/push: %d/%d)", pop_count, push_count);
data_empty.wait(lock, [this] { return !isQueueEmpty(); });
ml_logd("pop condition is met");

Expand Down
7 changes: 4 additions & 3 deletions nntrainer/compiler/recurrent_realizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,10 @@ RecurrentRealizer::RecurrentRealizer(const std::vector<std::string> &properties,
std::vector<props::InputIsSequence>(), props::DynamicTimeSequence(false))) {
auto left = loadProperties(properties, *recurrent_props);

std::transform(input_conns.begin(), input_conns.end(),
std::inserter(this->input_layers, this->input_layers.begin()),
[](const Connection &c) { return c.getName(); });
std::transform(
input_conns.begin(), input_conns.end(),
std::inserter(this->input_layers, this->input_layers.begin()),
[](const Connection &c) -> const auto & { return c.getName(); });

/// build end info.
/// eg)
Expand Down
14 changes: 8 additions & 6 deletions nntrainer/compiler/slice_realizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ SliceRealizer::SliceRealizer(const std::vector<Connection> &start_layers,
/// discard index information as it is not needed as it is not really needed
this->start_layers.reserve(start_layers.size());

std::transform(start_layers.begin(), start_layers.end(),
std::back_inserter(this->start_layers),
[](const Connection &c) { return c.getName(); });
std::transform(
start_layers.begin(), start_layers.end(),
std::back_inserter(this->start_layers),
[](const Connection &c) -> const auto & { return c.getName(); });

std::transform(end_layers.begin(), end_layers.end(),
std::inserter(this->end_layers, this->end_layers.begin()),
[](const Connection &c) { return c.getName(); });
std::transform(
end_layers.begin(), end_layers.end(),
std::inserter(this->end_layers, this->end_layers.begin()),
[](const Connection &c) -> const auto & { return c.getName(); });
}

SliceRealizer::~SliceRealizer() {}
Expand Down

0 comments on commit e93fc05

Please sign in to comment.