@@ -132,6 +132,8 @@ extern "C" bridge_tensor_t load_run_model(const uint8_t* model_path, bridge_tens
132132
133133
134134extern " C" bridge_pt_model_t load_model (const uint8_t * model_path) {
135+ std::cout << " Begin loading model from path: " << model_path << std::endl;
136+ std::cout.flush ();
135137 std::string mp (reinterpret_cast <const char *>(model_path));
136138 std::cout << " Loading model from path: " << mp << std::endl;
137139 std::cout.flush ();
@@ -141,20 +143,28 @@ extern "C" bridge_pt_model_t load_model(const uint8_t* model_path) {
141143 try {
142144 *pt_module = torch::jit::load (mp);
143145 std::cout << " Model loaded successfully!" << std::endl;
144- model_wrapper.pt_module = (uint64_t ) pt_module;
146+ std::cout.flush ();
147+ model_wrapper.pt_module = pt_module;
145148 } catch (const c10::Error& e) {
146149 std::cerr << " error loading the model\n " << e.msg ();
150+ std::cout << " error loading the model\n " << e.msg ();
151+ std::cout.flush ();
152+ std::cerr.flush ();
147153 }
148154
155+ std::cout << pt_module->dump_to_str (false ,false ,false ) << std::endl;
156+ std::cout.flush ();
157+
149158 return model_wrapper;
150159}
151160
152161extern " C" bridge_tensor_t model_forward (bridge_pt_model_t model, bridge_tensor_t input) {
153162 auto t_input = bridge_to_torch (input);
154163 std::vector<torch::jit::IValue> inputs;
155164 inputs.push_back (t_input);
156- torch::jit::Module* pt_module = (torch::jit::Module*) model.pt_module ;
157- auto output = pt_module->forward (inputs).toTensor ();
165+ // torch::jit::Module* pt_module = (torch::jit::Module*) model.pt_module;
166+ // auto output = pt_module->forward(inputs).toTensor();
167+ auto output = t_input;
158168 return torch_to_bridge (output);
159169}
160170
0 commit comments