MCPcopy Create free account
hub / github.com/OpenPPL/ppl.nn / SetInputs

Function SetInputs

tools/pplnn.cc:1040–1059  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1038#endif
1039
1040static 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
1061static bool GetOutputs(const Runtime* runtime) {
1062 for (uint32_t c = 0; c < runtime->GetOutputCount(); ++c) {

Callers 1

ProfilingFunction · 0.70

Calls 5

GetInputTensorMethod · 0.80
GetInputCountMethod · 0.45
GetShapeMethod · 0.45
ConvertFromHostMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected