diff --git a/aidge_core/static_analysis.py b/aidge_core/static_analysis.py index add0c991004304770056bde13aadc531eb6ce4cc..c65a102a10601605cd2ca988a2ad3cf2cbd00e6e 100644 --- a/aidge_core/static_analysis.py +++ b/aidge_core/static_analysis.py @@ -19,7 +19,9 @@ class StaticAnalysisExt(aidge_core.StaticAnalysis): series.append([name, self.get_nb_params(node)]) if title is None: title = "log_nb_params" - self._log_bar(series, filename, title, legend, log_scale) + if filename is not None: + self._log_bar(series, filename, title, legend, log_scale) + return series def log_params_size(self, filename, title=None, log_scale=False): namePtrTable = self.get_graph().get_ranked_nodes_name("{0} ({1}#{3})"); @@ -35,38 +37,40 @@ class StaticAnalysisExt(aidge_core.StaticAnalysis): series.append([name, self.log_params_size(node)]) if title is None: title = "log_params_size" - self._log_bar(series, filename, title, legend, log_scale) + if filename is not None: + self._log_bar(series, filename, title, legend, log_scale) + return series def log_nb_arithm_ops(self, filename, title=None, log_scale=False): - self._log_callback(aidge_core.OperatorStats.get_nb_arithm_ops, filename, title, log_scale) + return self._log_callback(aidge_core.OperatorStats.get_nb_arithm_ops, filename, title, log_scale) def log_nb_logic_ops(self, filename, title=None, log_scale=False): - self._log_callback(aidge_core.OperatorStats.get_nb_logic_ops, filename, title, log_scale) + return self._log_callback(aidge_core.OperatorStats.get_nb_logic_ops, filename, title, log_scale) def log_nb_comp_ops(self, filename, title=None, log_scale=False): - self._log_callback(aidge_core.OperatorStats.get_nb_comp_ops, filename, title, log_scale) + return self._log_callback(aidge_core.OperatorStats.get_nb_comp_ops, filename, title, log_scale) def log_nb_nl_ops(self, filename, title=None, log_scale=False): - self._log_callback(aidge_core.OperatorStats.get_nb_nl_ops, filename, title, log_scale) + return self._log_callback(aidge_core.OperatorStats.get_nb_nl_ops, filename, title, log_scale) def log_nb_mac_ops(self, filename, title=None, log_scale=False): - self._log_callback(aidge_core.OperatorStats.get_nb_mac_ops, filename, title, log_scale) + return self._log_callback(aidge_core.OperatorStats.get_nb_mac_ops, filename, title, log_scale) def log_nb_ops(self, filename, title=None, log_scale=False): - self._log_callback(aidge_core.OperatorStats.get_nb_ops, filename, title, log_scale) + return self._log_callback(aidge_core.OperatorStats.get_nb_ops, filename, title, log_scale) def log_nb_arithm_int_ops(self, filename, title=None, log_scale=False): - self._log_callback(aidge_core.OperatorStats.get_nb_arithm_int_ops, filename, title, log_scale) + return self._log_callback(aidge_core.OperatorStats.get_nb_arithm_int_ops, filename, title, log_scale) def log_nb_arithm_fp_ops(self, filename, title=None, log_scale=False): - self._log_callback(aidge_core.OperatorStats.get_nb_arithm_fp_ops, filename, title, log_scale) + return self._log_callback(aidge_core.OperatorStats.get_nb_arithm_fp_ops, filename, title, log_scale) def log_nb_ops_by_type(self, filename, title=None, log_scale=False): - self._log_callback([aidge_core.OperatorStats.get_nb_arithm_int_ops, - aidge_core.OperatorStats.get_nb_arithm_fp_ops, - aidge_core.OperatorStats.get_nb_logic_ops, - aidge_core.OperatorStats.get_nb_comp_ops, - aidge_core.OperatorStats.get_nb_nl_ops], filename, title, log_scale) + return self._log_callback([aidge_core.OperatorStats.get_nb_arithm_int_ops, + aidge_core.OperatorStats.get_nb_arithm_fp_ops, + aidge_core.OperatorStats.get_nb_logic_ops, + aidge_core.OperatorStats.get_nb_comp_ops, + aidge_core.OperatorStats.get_nb_nl_ops], filename, title, log_scale) def _log_callback(self, callback, filename, title=None, log_scale=False): """ @@ -115,7 +119,9 @@ class StaticAnalysisExt(aidge_core.StaticAnalysis): if title is None: title = callback.__name__ if title is None: title = str(callback) - self._log_bar(series, filename, title, legend, log_scale) + if filename is not None: + self._log_bar(series, filename, title, legend, log_scale) + return series def _log_bar(self, series, filename, title=None, legend=None, log_scale=False): names, values = zip(*series)