| 1059 | } |
| 1060 | |
| 1061 | static bool GetOutputs(const Runtime* runtime) { |
| 1062 | for (uint32_t c = 0; c < runtime->GetOutputCount(); ++c) { |
| 1063 | auto t = runtime->GetOutputTensor(c); |
| 1064 | |
| 1065 | ppl::nn::TensorShape dst_desc = *t->GetShape(); |
| 1066 | dst_desc.SetDataFormat(DATAFORMAT_NDARRAY); |
| 1067 | if (dst_desc.GetDataType() == DATATYPE_FLOAT16) { |
| 1068 | dst_desc.SetDataType(DATATYPE_FLOAT32); |
| 1069 | } |
| 1070 | auto bytes = dst_desc.CalcBytesIncludingPadding(); |
| 1071 | vector<char> buffer(bytes); |
| 1072 | auto status = t->ConvertToHost(buffer.data(), dst_desc); |
| 1073 | if (status != RC_SUCCESS) { |
| 1074 | LOG(ERROR) << "convert data of tensor[" << t->GetName() << "] failed: " << GetRetCodeStr(status); |
| 1075 | return false; |
| 1076 | } |
| 1077 | } |
| 1078 | |
| 1079 | return true; |
| 1080 | } |
| 1081 | |
| 1082 | static bool Profiling(const vector<string>& input_data, Runtime* runtime) { |
| 1083 | if (g_flag_warmup_iterations > 0) { |
no test coverage detected