@@ -18,18 +18,18 @@ limitations under the License.
1818#include < string>
1919#include < vector>
2020
21+ #include < string.h>
2122#include " api/c_api.h"
2223#include " core/config.h"
2324#include " core/runtime.h"
24- #include < string.h>
2525#include " json/json.h"
2626
2727#ifdef __cplusplus
2828extern " C" {
2929#endif // __cplusplus
3030
3131using delta::RuntimeConfig;
32- // using delta::Config;
32+ // using delta::Config;
3333using delta::core::In;
3434using delta::core::Runtime;
3535
@@ -70,42 +70,42 @@ DeltaStatus DeltaSetInputs(InferHandel inf, Input* inputs, int num) {
7070DeltaStatus DeltaSetJsonInputs (InferHandel inf, const char * inputs) {
7171 // only support int input now
7272 // TODO: support int, string, float
73- // std::string yaml = yaml_file;
74- // Config* conf = new Config(yaml_file);
73+ // std::string yaml = yaml_file;
74+ // Config* conf = new Config(yaml_file);
7575 Runtime* rt = static_cast <Runtime*>(inf);
7676 bool bRet = false ;
7777
7878 Json::Reader reader;
7979 Json::Value root;
80- Json::Value::Members keys;
80+ Json::Value::Members keys;
8181
8282 bRet = reader.parse (inputs, root);
8383 if (false == bRet) {
8484 LOG_FATAL << " error: input_json parse failed.\n " ;
8585 return DeltaStatus::kDeltaError ;
8686 }
87- keys = root.getMemberNames ();
87+ keys = root.getMemberNames ();
8888 int idx = 0 ;
8989 int num = keys.size ();
9090 Input* ins = new Input[num]();
9191 std::vector<In> insVec;
92- for (Json::Value::Members::iterator iterKey = keys.begin (); iterKey != keys. end (); iterKey++)
93- {
94- std::string strKey = *iterKey;
95- Json::Value val_array = root[*iterKey];
96- int iSize = val_array.size ();
92+ for (Json::Value::Members::iterator iterKey = keys.begin ();
93+ iterKey != keys. end (); iterKey++) {
94+ std::string strKey = *iterKey;
95+ Json::Value val_array = root[*iterKey];
96+ int iSize = val_array.size ();
9797 int * input_val = new int [iSize]();
98- for ( int nIndex = 0 ;nIndex < iSize;++ nIndex ) {
98+ for (int nIndex = 0 ; nIndex < iSize; ++ nIndex) {
9999 input_val[nIndex] = val_array[nIndex].asInt ();
100100 }
101101 ins[idx].ptr = reinterpret_cast <void *>(input_val);
102102 ins[idx].nelms = iSize;
103- // ins[idx].shape = (*conf).config()["model"]["graphs"][0]["inputs"][idx]["shape"].as<std::vector<int>>().data();
103+ // ins[idx].shape =
104+ // (*conf).config()["model"]["graphs"][0]["inputs"][idx]["shape"].as<std::vector<int>>().data();
104105 ins[idx].input_name = strKey.c_str ();
105106 ins[idx].graph_name = " default" ;
106- insVec.push_back (In (ins[idx].graph_name , ins[idx].input_name ,
107- ins[idx].ptr ,
108- ins[idx].nelms ));
107+ insVec.push_back (In (ins[idx].graph_name , ins[idx].input_name , ins[idx].ptr ,
108+ ins[idx].nelms ));
109109 idx += 1 ;
110110 }
111111 LOG_INFO << " ins size:" << insVec.size ();
0 commit comments