def _get_comparison_statistics(curr_tensor, prev_tensor): """Get comparison statistics.""" stats_info = {} diff_tensor_stats = curr_tensor.tensor_comparison.stats curr_tensor_stats = TensorUtils.get_statistics_from_tensor(curr_tensor.value) prev_tensor_stats = TensorUtils.get_statistics_from_tensor(prev_tensor.value) stats_info['curr_step_statistics'] = TensorUtils.get_overall_statistic_dict(overall_stats=curr_tensor_stats) stats_info['prev_step_statistics'] = TensorUtils.get_overall_statistic_dict(overall_stats=prev_tensor_stats) stats_info['statistics'] = TensorUtils.get_overall_statistic_dict(overall_stats=diff_tensor_stats) return stats_info
def get_tensor_statistics(self): """ Get Tensor statistics. Returns: dict, overall statistics. """ if self.empty or self.dtype == self._STRING_TYPE: return {} stats = TensorUtils.get_statistics_from_tensor(self.value) statistics = TensorUtils.get_overall_statistic_dict(stats) return statistics
def get_tensor_statistics(self): """ Get Tensor statistics. Returns: dict, overall statistics. """ if self.empty: return {} if not self.stats: self.stats = TensorUtils.get_statistics_from_tensor(self.value) statistics = TensorUtils.get_overall_statistic_dict(self.stats) return statistics