get onnx model from singa computational graph Args: inputs: a list of input tensors (each is initialized with a name) Args: y: a list of tensors, usually the outputs of the graph Returns: the onnx model
(cls, inputs, y, model_name="sonnx")
| 966 | |
| 967 | @classmethod |
| 968 | def singa_to_onnx_model(cls, inputs, y, model_name="sonnx"): |
| 969 | """ |
| 970 | get onnx model from singa computational graph |
| 971 | Args: |
| 972 | inputs: a list of input tensors (each is initialized with a name) |
| 973 | Args: |
| 974 | y: a list of tensors, usually the outputs of the graph |
| 975 | Returns: |
| 976 | the onnx model |
| 977 | """ |
| 978 | opset_id = OperatorSetIdProto() |
| 979 | opset_id.version = cls._target_opset_version |
| 980 | model = helper.make_model(cls.singa_to_onnx_graph(inputs, |
| 981 | y, |
| 982 | model_name="sonnx"), |
| 983 | producer_name='sonnx', |
| 984 | opset_imports=[opset_id]) |
| 985 | model = optimizer.optimize(model) |
| 986 | checker.check_model(model) |
| 987 | return model |
| 988 | |
| 989 | |
| 990 | class OnnxNode(object): |
nothing calls this directly
no test coverage detected