提交 62ce588e 编写于 作者: G guru4elephant

fix go request

上级 27877423
...@@ -28,7 +28,7 @@ func main() { ...@@ -28,7 +28,7 @@ func main() {
var config_file_path string var config_file_path string
config_file_path = os.Args[1] config_file_path = os.Args[1]
handle := serving_client.LoadModelConfig(config_file_path) handle := serving_client.LoadModelConfig(config_file_path)
handle = serving_client.Connect("127.0.0.1", "9292", handle) handle = serving_client.Connect("127.0.0.1", "9393", handle)
test_file_path := os.Args[2] test_file_path := os.Args[2]
fi, err := os.Open(test_file_path) fi, err := os.Open(test_file_path)
......
...@@ -43,11 +43,12 @@ type FetchInst struct { ...@@ -43,11 +43,12 @@ type FetchInst struct {
type Request struct { type Request struct {
Insts []FeedInst `json:"insts"` Insts []FeedInst `json:"insts"`
FetchVarNames []string `json:"fetch_var_names"` FetchVarNames []string `json:"fetch_var_names"`
ProfileServer bool `json:"profile_server"`
} }
type Response struct { type Response struct {
Insts []FetchInst `json:"insts"` Insts []FetchInst `json:"insts"`
MeanInferUs float32 `json:"mean_infer_us"` ProfileTime []int64 `json:"profile_time"`
} }
type Handle struct { type Handle struct {
...@@ -125,9 +126,13 @@ func Predict(handle Handle, int_feed_map map[string][]int64, fetch []string) map ...@@ -125,9 +126,13 @@ func Predict(handle Handle, int_feed_map map[string][]int64, fetch []string) map
inst.TensorArray = tensor_array inst.TensorArray = tensor_array
var profiletime bool
profiletime = false
req := &Request{ req := &Request{
Insts: []FeedInst{inst}, Insts: []FeedInst{inst},
FetchVarNames: fetch} FetchVarNames: fetch,
ProfileTime: profiletime}
b, err := json.Marshal(req) b, err := json.Marshal(req)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册