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

Function GetOutputs

tools/pplnn.cc:1061–1080  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1059}
1060
1061static 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
1082static bool Profiling(const vector<string>& input_data, Runtime* runtime) {
1083 if (g_flag_warmup_iterations > 0) {

Callers 1

ProfilingFunction · 0.70

Calls 5

GetOutputTensorMethod · 0.80
GetOutputCountMethod · 0.45
GetShapeMethod · 0.45
ConvertToHostMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected