parse the inits, outputs from onnx graph Args: graph (Graph): a given onnx graph device (string): # CPU or CUDA Returns: a dict of ValueInfo a dict of ValueInfo
(cls, graph, params, device)
| 1849 | |
| 1850 | @classmethod |
| 1851 | def _parse_graph_inputs_outputs(cls, graph, params, device): |
| 1852 | """ |
| 1853 | parse the inits, outputs from onnx graph |
| 1854 | Args: |
| 1855 | graph (Graph): a given onnx graph |
| 1856 | device (string): # CPU or CUDA |
| 1857 | Returns: |
| 1858 | a dict of ValueInfo |
| 1859 | a dict of ValueInfo |
| 1860 | """ |
| 1861 | inputs = [] |
| 1862 | outputs = [] |
| 1863 | info_tuple = namedtuple('info_tuple', ['name', 'dtype', 'shape']) |
| 1864 | for t in graph.input: |
| 1865 | if t.name not in params: |
| 1866 | dtype = t.type.tensor_type.elem_type |
| 1867 | shape = [dim.dim_value for dim in t.type.tensor_type.shape.dim] |
| 1868 | inputs.extend([info_tuple(t.name, dtype, shape)]) |
| 1869 | for t in graph.output: |
| 1870 | dtype = t.type.tensor_type.elem_type |
| 1871 | shape = [dim.dim_value for dim in t.type.tensor_type.shape.dim] |
| 1872 | outputs.extend([info_tuple(t.name, dtype, shape)]) |
| 1873 | return inputs, outputs |
| 1874 | |
| 1875 | @classmethod |
| 1876 | def _onnx_model_to_singa_ops(cls, |
no outgoing calls
no test coverage detected