MCPcopy Create free account
hub / github.com/apache/singa / _parse_graph_params

Method _parse_graph_params

python/singa/sonnx.py:1834–1848  ·  view source on GitHub ↗

parse the parameters from onnx graph Args: graph (Graph): a given onnx graph device (string): CPU or CUDA Returns: a dict of numpy ndarray

(cls, graph, device)

Source from the content-addressed store, hash-verified

1832
1833 @classmethod
1834 def _parse_graph_params(cls, graph, device):
1835 """
1836 parse the parameters from onnx graph
1837 Args:
1838 graph (Graph): a given onnx graph
1839 device (string): CPU or CUDA
1840 Returns:
1841 a dict of numpy ndarray
1842 """
1843 params = {}
1844 for tp in graph.initializer:
1845 val = numpy_helper.to_array(tp)
1846 val = val.astype(onnx_type_to_singa_type(tp.data_type))
1847 params[tp.name] = val
1848 return params
1849
1850 @classmethod
1851 def _parse_graph_inputs_outputs(cls, graph, params, device):

Callers 1

Calls 1

onnx_type_to_singa_typeFunction · 0.85

Tested by

no test coverage detected