nat.profiler.prediction_trie.serialization#

Attributes#

Functions#

save_prediction_trie(→ None)

Save a prediction trie to a JSON file.

load_prediction_trie(...)

Load a prediction trie from a JSON file.

_serialize_node(→ dict[str, Any])

Serialize a trie node to a dictionary.

_deserialize_node(...)

Deserialize a dictionary to a trie node.

Module Contents#

CURRENT_VERSION = '1.0'#
save_prediction_trie(
trie: nat.profiler.prediction_trie.data_models.PredictionTrieNode,
path: pathlib.Path,
workflow_name: str = 'unknown',
) None#

Save a prediction trie to a JSON file.

Args:

trie: The prediction trie root node path: Path to save the JSON file workflow_name: Name of the workflow this trie was built from

load_prediction_trie(
path: pathlib.Path,
) nat.profiler.prediction_trie.data_models.PredictionTrieNode#

Load a prediction trie from a JSON file.

Args:

path: Path to the JSON file

Returns:

The deserialized prediction trie root node

_serialize_node(
node: nat.profiler.prediction_trie.data_models.PredictionTrieNode,
) dict[str, Any]#

Serialize a trie node to a dictionary.

_deserialize_node(
data: dict[str, Any],
) nat.profiler.prediction_trie.data_models.PredictionTrieNode#

Deserialize a dictionary to a trie node.