| 1038 | #endif |
| 1039 | |
| 1040 | static bool SetInputs(const vector<string>& input_data, Runtime* runtime) { |
| 1041 | if (input_data.size() != runtime->GetInputCount()) { |
| 1042 | LOG(ERROR) << "number of input data [" << input_data.size() << "] != runtime input count [" |
| 1043 | << runtime->GetInputCount() << "]"; |
| 1044 | return false; |
| 1045 | } |
| 1046 | |
| 1047 | for (uint32_t i = 0; i < runtime->GetInputCount(); ++i) { |
| 1048 | auto t = runtime->GetInputTensor(i); |
| 1049 | ppl::nn::TensorShape src_desc = *t->GetShape(); |
| 1050 | src_desc.SetDataFormat(DATAFORMAT_NDARRAY); |
| 1051 | auto status = t->ConvertFromHost(input_data[i].data(), src_desc); |
| 1052 | if (status != RC_SUCCESS) { |
| 1053 | LOG(ERROR) << "set input [" << t->GetName() << "] failed: " << GetRetCodeStr(status); |
| 1054 | return false; |
| 1055 | } |
| 1056 | } |
| 1057 | |
| 1058 | return true; |
| 1059 | } |
| 1060 | |
| 1061 | static bool GetOutputs(const Runtime* runtime) { |
| 1062 | for (uint32_t c = 0; c < runtime->GetOutputCount(); ++c) { |
no test coverage detected