Browse Source

!8057 modify files for static check

Merge pull request !8057 from lyvette/check_master
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
d31eff00db
2 changed files with 9 additions and 4 deletions
  1. +1
    -3
      mindspore/lite/tools/benchmark/benchmark.cc
  2. +8
    -1
      mindspore/lite/tools/converter/legacy_optimizer/graph/trans_format_insert_pass.cc

+ 1
- 3
mindspore/lite/tools/benchmark/benchmark.cc View File

@@ -427,10 +427,8 @@ int Benchmark::RunBenchmark() {
return ret;
}
}
if (model == nullptr) {
MS_LOG(ERROR) << "model is null.";
if (model != nullptr) {
model->Free();
return RET_NULL_PTR;
}
ms_inputs_ = session_->GetInputs();
auto end_prepare_time = GetTimeUs();


+ 8
- 1
mindspore/lite/tools/converter/legacy_optimizer/graph/trans_format_insert_pass.cc View File

@@ -88,7 +88,10 @@ bool TransOpInsertPass::CanFusion(schema::MetaGraphT *graph, const std::unique_p
auto total_node_count = input_node_indexes.size() + output_node_indexes.size();
size_t half_count = total_node_count / 2;
if (GetCNodeTType(*node) == schema::PrimitiveType_Activation) {
if (node->primitive->value.AsActivation()->type == schema::ActivationType_LEAKY_RELU) {
MS_ASSERT(node != nullptr);
MS_ASSERT(node->primitive != nullptr);
if (node->primitive->value.AsActivation() != nullptr &&
node->primitive->value.AsActivation()->type == schema::ActivationType_LEAKY_RELU) {
return has_trans_count >= half_count;
}
}
@@ -223,6 +226,10 @@ STATUS TransOpInsertPass::Run(schema::MetaGraphT *graph) {
changed = false;
for (auto iter = graph->nodes.begin(); iter != graph->nodes.end(); iter++) {
auto &node = *iter;
if (node == nullptr && node->primitive == nullptr) {
MS_LOG(ERROR) << "node or primitive null";
return RET_NULL_PTR;
}
auto type = node->primitive->value.type;
if (IsContain(has_insert_nodes, node.get()) || !IsContain(GetInsertOpList(), type)) {
continue;


Loading…
Cancel
Save