general_model_service.proto 2.8 KB
Newer Older
G
guru4elephant 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

S
ShiningZhang 已提交
15
syntax = "proto3";
G
guru4elephant 已提交
16 17 18 19 20 21 22
import "pds_option.proto";
import "builtin_format.proto";
package baidu.paddle_serving.predictor.general_model;

option cc_generic_services = true;

message Tensor {
S
ShiningZhang 已提交
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
  // VarType: INT64
  repeated int64 int64_data = 1;

  // VarType: FP32
  repeated float float_data = 2;

  // VarType: INT32
  repeated int32 int_data = 3;

  // VarType: FP64
  repeated double float64_data = 4;

  // VarType: UINT32
  repeated uint32 uint32_data = 5;

  // VarType: BOOL
  repeated bool bool_data = 6;

  // (No support)VarType: COMPLEX64, 2x represents the real part, 2x+1
  // represents the imaginary part
  repeated float complex64_data = 7;

  // (No support)VarType: COMPLEX128, 2x represents the real part, 2x+1
  // represents the imaginary part
  repeated double complex128_data = 8;

  // VarType: STRING
  repeated string data = 9;

  // Element types:
  //   0 => INT64
  //   1 => FP32
  //   2 => INT32
  //   3 => FP64
  //   4 => INT16
  //   5 => FP16
  //   6 => BF16
  //   7 => UINT8
  //   8 => INT8
  //   9 => BOOL
  //  10 => COMPLEX64
  //  11 => COMPLEX128
  //  20 => STRING
  int32 elem_type = 10;

  // Shape of the tensor, including batch dimensions.
  repeated int32 shape = 11;

  // Level of data(LOD), support variable length data, only for fetch tensor
  // currently.
  repeated int32 lod = 12;

  // Correspond to the variable 'name' in the model description prototxt.
  string name = 13;

  // Correspond to the variable 'alias_name' in the model description prototxt.
  string alias_name = 14; // get from the Model prototxt

  // VarType: FP16, INT16, INT8, BF16, UINT8
  bytes tensor_content = 15;
G
guru4elephant 已提交
83 84 85
};

message Request {
H
HexToString 已提交
86
  repeated Tensor tensor = 1;
87
  repeated string fetch_var_names = 2;
S
ShiningZhang 已提交
88 89
  bool profile_server = 3;
  uint64 log_id = 4;
G
guru4elephant 已提交
90 91 92
};

message Response {
B
barrierye 已提交
93
  repeated ModelOutput outputs = 1;
G
guru4elephant 已提交
94
  repeated int64 profile_time = 2;
95 96
  bool profile_server = 3;
  uint64 log_id = 4;
T
TeslaZhao 已提交
97

S
ShiningZhang 已提交
98
  // Error code
99
  int32 err_no = 5;
S
ShiningZhang 已提交
100
  // Error messages
101
  string err_msg = 6;
G
guru4elephant 已提交
102 103
};

B
barrierye 已提交
104
message ModelOutput {
H
HexToString 已提交
105
  repeated Tensor tensor = 1;
S
ShiningZhang 已提交
106
  string engine_name = 2;
B
barrierye 已提交
107 108
}

G
guru4elephant 已提交
109 110 111 112 113
service GeneralModelService {
  rpc inference(Request) returns (Response);
  rpc debug(Request) returns (Response);
  option (pds.options).generate_stub = true;
};