public void set_param(FactoryClientParamWrapper param) { csharpaidiclientPINVOKE.AidiFactoryRunner_set_param(swigCPtr, FactoryClientParamWrapper.getCPtr(param)); if (csharpaidiclientPINVOKE.SWIGPendingException.Pending) { throw csharpaidiclientPINVOKE.SWIGPendingException.Retrieve(); } }
public bool Init(string work_path, int gpu_number, IntVector batch_size) { if (!is_ready) { // get module_type list StringVector module_type = get_all_module_from_work_path(work_path); foreach (string type in module_type) { Console.WriteLine("module type : " + type); } // check batch_size if (module_type.Count != batch_size.Count) { Console.WriteLine("module type must = batch_size numnber"); // return false; } StringVector module_model_list = new StringVector(); for (int i = 0; i < module_type.Count; i++) { string current_module_model_path = work_path + "/" + module_type[i] + "_" + i.ToString() + "/model/"; string current_module_model_aqbin_path = work_path + "/" + module_type[i] + "_" + i.ToString() + "/model/model.aqbin"; string current_module_model_json_path = work_path + "/" + module_type[i] + "_" + i.ToString() + "/model/param.json"; // check model path if (!File.Exists(current_module_model_aqbin_path)) { throw new FileNotFoundException("模型文件model.aqbin不存在,当前路径:" + current_module_model_path); } if (!File.Exists(current_module_model_json_path)) { throw new FileNotFoundException("模型配置文件param.json不存在,当前路径:" + current_module_model_path); } if (!Directory.Exists(current_module_model_path)) { throw new FileNotFoundException("模型路径不存在,当前路径:" + current_module_model_path); } module_model_list.Add(current_module_model_path); } for (int i = 0; i < module_model_list.Count; i++) { Console.WriteLine(module_model_list[i]); } // init aidi_ = new AidiFactoryRunner(check_code_); FactoryClientParamWrapper param = new FactoryClientParamWrapper(); param.device_number = gpu_number; param.save_model_path_list = module_model_list; param.operator_type_list = module_type; param.use_runtime = false; aidi_.set_param(param); aidi_.set_batch_size(batch_size); aidi_.start(); is_ready = true; } return(is_ready); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FactoryClientParamWrapper obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }