diff --git a/mindspore/lite/tools/benchmark/benchmark.cc b/mindspore/lite/tools/benchmark/benchmark.cc index 473913841822d9e86b6c1f13b50d6168404fd30b..1c3e929284b0ebd8bddf6424e8d869e2dffe150d 100644 --- a/mindspore/lite/tools/benchmark/benchmark.cc +++ b/mindspore/lite/tools/benchmark/benchmark.cc @@ -234,17 +234,21 @@ int Benchmark::CompareOutput() { MS_LOG(ERROR) << "Cannot find output node: " << nodeName.c_str() << " , compare output data fail."; return RET_ERROR; } - for (auto tensor : tensors) { - MS_ASSERT(tensor->GetDataType() == DataType_DT_FLOAT); - MS_ASSERT(tensor->GetData() != nullptr); - float bias = CompareData(nodeName, tensor->shape(), static_cast(tensor->MutableData())); - if (bias >= 0) { - totalBias += bias; - totalSize++; - } else { - hasError = true; - break; - } + // make sure tensor size is 1 + if (tensors.size() != 1) { + MS_LOG(ERROR) << "Only support 1 tensor with a name now."; + return RET_ERROR; + } + auto &tensor = tensors.front(); + MS_ASSERT(tensor->GetDataType() == DataType_DT_FLOAT); + MS_ASSERT(tensor->GetData() != nullptr); + float bias = CompareData(nodeName, tensor->shape(), static_cast(tensor->MutableData())); + if (bias >= 0) { + totalBias += bias; + totalSize++; + } else { + hasError = true; + break; } }