onnx_extended.tools.stats_nodes#
enumerate_nodes#
- onnx_extended.tools.stats_nodes.enumerate_nodes(onx: FunctionProto | GraphProto | ModelProto, recursive: bool = True) Iterable[Tuple[Tuple[str, ...], GraphProto | FunctionProto, NodeProto | TensorProto | SparseTensorProto]] [source]#
Enumerates all nodes in a model.
- Parameters:
onx – the model
recursive – look into subgraphs
- Returns:
enumerate tuple (name, parent, node)
enumerate_stats_nodes#
- onnx_extended.tools.stats_nodes.enumerate_stats_nodes(onx: FunctionProto | GraphProto | ModelProto, recursive: bool = True, stats_fcts: Dict[Tuple[str, str], Callable[[GraphProto | FunctionProto, NodeProto | TensorProto | SparseTensorProto], NodeStatistics | HistStatistics]] | None = None) Iterable[Tuple[Tuple[str, ...], GraphProto | FunctionProto, NodeStatistics | HistStatistics]] [source]#
Computes statistics of nodes functions.
- Parameters:
onx – the model
recursive – look into subgraphs
stats_fcts – a dicionary of functions to call for every node, the key is (domain, op_type), if None, uses the default statistiques
- Returns:
enumerate tuple (name, parent, statistics)
HistStatistics#
- class onnx_extended.tools.stats_nodes.HistStatistics(parent: GraphProto | FunctionProto, node: NodeProto | TensorProto | SparseTensorProto, bins: int = 20)[source]#
Stores statistics on constants.
- property values#
Returns the values as an array.
HistTreeStatistics#
NodeStatistics#
- class onnx_extended.tools.stats_nodes.NodeStatistics(parent: GraphProto | FunctionProto, node: NodeProto)[source]#
Stores many statistics for NodeProto.
stats_tree_ensemble#
- onnx_extended.tools.stats_nodes.stats_tree_ensemble(parent: GraphProto | FunctionProto, node: NodeProto) NodeStatistics [source]#
Computes statistics on every tree of a TreeEnsemble.
- Parameters:
parent – function or graph proto hosting the node
node – node
- Returns:
instance of NodeStatistics