tvm_ffi.serialization

tvm_ffi.serialization#

Serialization related utilities to enable some object can be pickled.

Functions

from_json_graph_str(json_str)

Load an object from a JSON graph string.

to_json_graph_str(obj[, metadata])

Dump an object to a JSON graph string.

tvm_ffi.serialization.from_json_graph_str(json_str)[source]#

Load an object from a JSON graph string.

The JSON graph string is a string representation of of the object graph that also includes the reference information.

Parameters:

json_str (str) – The JSON graph string to load.

Return type:

Any

Returns:

obj – The loaded object.

tvm_ffi.serialization.to_json_graph_str(obj, metadata=None)[source]#

Dump an object to a JSON graph string.

The JSON graph string is a string representation of of the object graph includes the reference information of same objects, which can be used for serialization and debugging.

Parameters:
  • obj (Any) – The object to save.

  • metadata (dict[str, Any] | None, default: None) – Extra metadata to save into the json graph string.

Return type:

str

Returns:

json_str – The JSON graph string.