MCPcopy
hub / github.com/OpenPPL/ppq / convert_value

Method convert_value

ppq/samples/Tutorial/targetPlatform.py:124–129  ·  view source on GitHub ↗
(self, value: torch.Tensor)

Source from the content-addressed store, hash-verified

122
123class MyExporter(OnnxExporter):
124 def convert_value(self, value: torch.Tensor) -> str:
125 if type(value) in {int, float}: return value
126 else:
127 value = convert_any_to_numpy(value, accept_none=True)
128 if value is None: return value # SOI config has Nona as its scale and
129 return value.tolist()
130
131 def export(self, file_path: str, graph: BaseGraph, config_path: str, **kwargs):
132 # ------------------------------------------------------------

Callers 1

exportMethod · 0.95

Calls 2

convert_any_to_numpyFunction · 0.90
tolistMethod · 0.80

Tested by

no test coverage detected