MCPcopy Create free account
hub / github.com/PaddlePaddle/Serving / create

Method create

python/paddle_serving_server/dag.py:37–73  ·  view source on GitHub ↗
(self,
               node_type,
               engine_name=None,
               inputs=[],
               outputs=[],
               addresses=[])

Source from the content-addressed store, hash-verified

35 self.node_name_suffix_ = collections.defaultdict(int)
36
37 def create(self,
38 node_type,
39 engine_name=None,
40 inputs=[],
41 outputs=[],
42 addresses=[]):
43 if node_type not in self.op_list:
44 raise Exception("Op type {} is not supported right now".format(
45 node_type))
46 node = server_sdk.DAGNode()
47 # node.name will be used as the infer engine name
48 if engine_name:
49 node.name = engine_name
50 else:
51 node.name = '{}_{}'.format(node_type,
52 self.node_name_suffix_[node_type])
53 self.node_name_suffix_[node_type] += 1
54
55 node.type = node_type
56 if inputs:
57 for dep_node_str in inputs:
58 dep_node = server_sdk.DAGNode()
59 google.protobuf.text_format.Parse(dep_node_str, dep_node)
60 dep = server_sdk.DAGNodeDependency()
61 dep.name = dep_node.name
62 dep.mode = "RO"
63 node.dependencies.extend([dep])
64
65 # for general_remote op.
66 if addresses:
67 node.address.extend(addresses)
68
69 # Because the return value will be used as the key value of the
70 # dict, and the proto object is variable which cannot be hashed,
71 # so it is processed into a string. This has little effect on
72 # overall efficiency.
73 return google.protobuf.text_format.MessageToString(node)
74
75
76class OpSeqMaker(object):

Callers 3

default_rpc_serviceMethod · 0.95
start_gpu_card_modelFunction · 0.95
_prepare_one_serverMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected