MCPcopy Index your code
hub / github.com/apache/tvm / save_param_dict

Function save_param_dict

python/tvm/runtime/params.py:35–63  ·  view source on GitHub ↗

Save parameter dictionary to binary bytes. The result binary bytes can be loaded by the GraphModule with API "load_params". Parameters ---------- params : dict of str to Tensor The parameter dictionary. Returns ------- param_bytes: bytearray Seriali

(params)

Source from the content-addressed store, hash-verified

33
34
35def save_param_dict(params):
36 """Save parameter dictionary to binary bytes.
37
38 The result binary bytes can be loaded by the
39 GraphModule with API "load_params".
40
41 Parameters
42 ----------
43 params : dict of str to Tensor
44 The parameter dictionary.
45
46 Returns
47 -------
48 param_bytes: bytearray
49 Serialized parameters.
50
51 Examples
52 --------
53 .. code-block:: python
54
55 # set up the parameter dict
56 params = {"param0": arr0, "param1": arr1}
57 # save the parameters as byte array
58 param_bytes = tvm.runtime.save_param_dict(params)
59 # We can serialize the param_bytes and load it back later.
60 # Pass in byte array to module to directly set parameters
61 tvm.runtime.load_param_dict(param_bytes)
62 """
63 return _ffi_api.SaveParams(_to_tensor(params))
64
65
66def save_param_dict_to_file(params, path):

Callers 1

_serialize_paramsFunction · 0.90

Calls 1

_to_tensorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…