forked from mindspore-Ecosystem/mindspore
!3969 benchmark cannot find output node bug add error log
Merge pull request !3969 from cjh9368/fix_benchmark_inf_bug
This commit is contained in:
commit
5cf20dc0da
|
@ -230,7 +230,16 @@ int Benchmark::CompareOutput() {
|
|||
for (const auto &calibTensor : calibData) {
|
||||
std::string nodeName = calibTensor.first;
|
||||
auto tensors = session->GetOutputsByName(nodeName);
|
||||
for (auto tensor : tensors) {
|
||||
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()));
|
||||
|
@ -242,7 +251,6 @@ int Benchmark::CompareOutput() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasError) {
|
||||
float meanBias;
|
||||
|
|
Loading…
Reference in New Issue