class_docstr: Compound combiner for Utility analysis per partition metrics.
class_docstr_tok: ["Compound","combiner","for","Utility","analysis","per","partition","metrics","."]
code: def merge_accumulators(
      self, acc1: AccumulatorType, acc2: AccumulatorType
  ):
      sparse1, dense1 = acc1
      sparse2, dense2 = acc2
  
      sparse_res = self._merge_sparse(sparse1, sparse2)
      merge_res = self._merge_dense(dense1, dense2)
      is_sparse_gr_dense = sparse_res is not None and len(
          sparse_res[0]
      ) > 2 * len(self._combiners)
      if is_sparse_gr_dense:
          merge_res = self._merge_dense(
              merge_res, self._to_dense(sparse_res)
          )
          sparse_res = None
      return sparse_res, merge_res
  
      if sparse1 and sparse2:
          merged_sparse = tuple(
              [_merge_list(s, t) for s, t in zip(sparse1, sparse2)]
          )
          # Computes heuristically that the sparse representation is less
          # than dense. For this assume that 1 accumulator is on average
          # has a size of aggregated contributions from 2 privacy ids.
          is_sparse_less_dense = len(merged_sparse[0]) <= 2 * len(
              self._combiners
          )
          if is_sparse_less_dense:
              return (merged_sparse, None)
          # Dense is smaller, convert to dense.
          return (None, self._to_dense(merged_sparse))
      dense1 = self._to_dense(sparse1) if sparse1 else dense1
      dense2 = self._to_dense(sparse2) if sparse2 else dense2
      merged_dense = super().merge_accumulators(dense1, dense2)
      return (None, merged_dense)
  
imports: import abc
  import copy
  from dataclasses import dataclass
  from typing import Any, List, Optional, Tuple
  import numpy
  import math
  import pipeline_dp
  from pipeline_dp import budget_accounting
  from pipeline_dp import dp_computations
  from analysis import metrics
  from analysis import poisson_binomial
  from pipeline_dp import partition_selection
label_desc: Use image node_id 5 for calling the CompoundCombiner obj's underlying member method code with example usage: obj.merge_accumulators(acc1, acc2) and returns: sparse_res,  merge_res, None,  merged_dense, None,  self, merged_sparse,  None