code: def chunk_tree_add(
      dtype, chunks, idx, shape, sparse=False, combine_size=None
  ):
      """
      Generate tree add plan.
  
      Assume combine size as 4, given a input chunks with size 8,
      we will generate tree add plan like:
  
      op op op op    op op op op
       |        |     |        |
        --------       --------
        tree_add        tree_add
            |             |
             -------------
                tree_add
  
      :param dtype: data type for tree added chunk
      :param chunks: input chunks
      :param idx: index of result chunk
      :param shape: shape of result chunk
      :param sparse: return value is sparse or dense
      :param combine_size: combine size
      :return: result chunk
      """
  
      class ChunkAddBuilder(TreeReductionBuilder):
          def _build_reduction(self, inputs, final=False):
              from .add import TensorTreeAdd
  
              op = TensorTreeAdd(
                  args=inputs, dtype=dtype, sparse=sparse
              )
              if not final:
                  return op.new_chunk(inputs, shape=shape)
              else:
                  return op.new_chunk(
                      inputs,
                      shape=shape,
                      index=idx,
                      order=chunks[0].order,
                  )
  
      return ChunkAddBuilder(combine_size).build(chunks)
  
imports: import numpy
  from ...utils import TreeReductionBuilder
label_desc: Use image node_id 2 for calling a global function with example usage: chunk_tree_add(dtype, chunks, idx, shape, sparse, combine_size) and returns: ChunkAddBuilder, op, op