提交 5cf20dc0 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!3969 benchmark cannot find output node bug add error log

Merge pull request !3969 from cjh9368/fix_benchmark_inf_bug
......@@ -230,17 +230,25 @@ int Benchmark::CompareOutput() {
for (const auto &calibTensor : calibData) {
std::string nodeName = calibTensor.first;
auto tensors = session->GetOutputsByName(nodeName);
for (auto tensor : tensors) {
MS_ASSERT(tensor->GetDataType() == DataType_DT_FLOAT);
MS_ASSERT(tensor->GetData() != nullptr);
float bias = CompareData(nodeName, tensor->shape(), static_cast<float *>(tensor->MutableData()));
if (bias >= 0) {
totalBias += bias;
totalSize++;
} else {
hasError = true;
break;
}
if (tensors.empty()) {
MS_LOG(ERROR) << "Cannot find output node: " << nodeName.c_str() << " , compare output data fail.";
return RET_ERROR;
}
// 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<float *>(tensor->MutableData()));
if (bias >= 0) {
totalBias += bias;
totalSize++;
} else {
hasError = true;
break;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册