docstr: Compute the child histogram.
  
  Args:
      weak_child: the splits of one child
      mapping: the mapping from parent to child,
          the mapping is a list of (parent_pos, weak_child_pos, target_weak_child_pos, target_strong_child_pos)
          which means in logic:
              output[target_weak_child_pos] = weak_child[weak_child_pos]
              output[target_strong_child_pos] = self[parent_pos] - weak_child[weak_child_pos]
  Examples:
      # tree structure:
      #              -1
      #        0            1
      #    2       3     4      5           <-- parent nodes, node #4 is leaf node
      #  6  *7  *8  9        *10 11         <-- child nodes, node #7, #8, #10 are weak child nodes
      #
      # pos  parent_node  weak_child_node  output_node
      #  0   #2           #7               #6
      #  1   #3           #8               #7
      #  2   #4           #10              #8
      #  3   #5                            #9
      #  4                                 #10
      #  5                                 #11
      >>> parent = DistributedHistogram(...) # data for nodes stored in order [#2, #3, #4, #5]
      >>> weak_child = DistributedHistogram(...) # data for nodes stored in order [#7, #8, #10]
      >>> mapping = [
      >>>     (0, 0, 1, 0),  # pos for (#2, #7, #7, #6)
      >>>     (1, 1, 2, 3),  # pos for (#3, #8, #8, #9)
      >>>     (3, 2, 4, 5)   # pos for (#5, #10, #10, #11)
      >>> ]
      >>> child = parent.compute_child(weak_child, mapping) # data for nodes stored in order [#6, #7, #8, #9, #10, #11]
docstr_tok: ["Compute","the","child","histogram",".","Args",":","weak_child",":","the","splits","of","one","child","mapping",":","the","mapping","from","parent","to","child",",","the","mapping","is","a","list","of","(","parent_pos",",","weak_child_pos",",","target_weak_child_pos",",","target_strong_child_pos",")","which","means","in","logic",":","output","[","target_weak_child_pos","]","=","weak_child","[","weak_child_pos","]","output","[","target_strong_child_pos","]","=","self","[","parent_pos","]","-","weak_child","[","weak_child_pos","]","Examples",":","#","tree","structure",":","#","-1","#","0","1","#","2","3","4","5","<","--","parent","nodes",",","node","#","4","is","leaf","node","#","6","*","7","*","8","9","*","10","11","<","--","child","nodes",",","node","#","7",",","#","8",",","#","10","are","weak","child","nodes","#","#","pos","parent_node","weak_child_node","output_node","#","0","#","2","#","7","#","6","#","1","#","3","#","8","#","7","#","2","#","4","#","10","#","8","#","3","#","5","#","9","#","4","#","10","#","5","#","11",">",">",">","parent","=","DistributedHistogram","(","...",")","#","data","for","nodes","stored","in","order","[","#","2",",","#","3",",","#","4",",","#","5","]",">",">",">","weak_child","=","DistributedHistogram","(","...",")","#","data","for","nodes","stored","in","order","[","#","7",",","#","8",",","#","10","]",">",">",">","mapping","=","[",">",">",">","(","0",",","0",",","1",",","0",")",",","#","pos","for","(","#","2",",","#","7",",","#","7",",","#","6",")",">",">",">","(","1",",","1",",","2",",","3",")",",","#","pos","for","(","#","3",",","#","8",",","#","8",",","#","9",")",">",">",">","(","3",",","2",",","4",",","5",")","#","pos","for","(","#","5",",","#","10",",","#","10",",","#","11",")",">",">",">","]",">",">",">","child","=","parent.compute_child","(","weak_child",",","mapping",")","#","data","for","nodes","stored","in","order","[","#","6",",","#","7",",","#","8",",","#","9",",","#","10",",","#","11","]"]
code: def compute_child(
      self,
      weak_child: "DistributedHistogram",
      mapping: List[Tuple[int, int, int, int]],
  ):
      """
      Compute the child histogram.
  
      Args:
          weak_child: the splits of one child
          mapping: the mapping from parent to child,
              the mapping is a list of (parent_pos, weak_child_pos, target_weak_child_pos, target_strong_child_pos)
              which means in logic:
                  output[target_weak_child_pos] = weak_child[weak_child_pos]
                  output[target_strong_child_pos] = self[parent_pos] - weak_child[weak_child_pos]
      Examples:
          # tree structure:
          #              -1
          #        0            1
          #    2       3     4      5           <-- parent nodes, node #4 is leaf node
          #  6  *7  *8  9        *10 11         <-- child nodes, node #7, #8, #10 are weak child nodes
          #
          # pos  parent_node  weak_child_node  output_node
          #  0   #2           #7               #6
          #  1   #3           #8               #7
          #  2   #4           #10              #8
          #  3   #5                            #9
          #  4                                 #10
          #  5                                 #11
          >>> parent = DistributedHistogram(...) # data for nodes stored in order [#2, #3, #4, #5]
          >>> weak_child = DistributedHistogram(...) # data for nodes stored in order [#7, #8, #10]
          >>> mapping = [
          >>>     (0, 0, 1, 0),  # pos for (#2, #7, #7, #6)
          >>>     (1, 1, 2, 3),  # pos for (#3, #8, #8, #9)
          >>>     (3, 2, 4, 5)   # pos for (#5, #10, #10, #11)
          >>> ]
          >>> child = parent.compute_child(weak_child, mapping) # data for nodes stored in order [#6, #7, #8, #9, #10, #11]
      """
      # assert self._node_size == weak_child._node_size, 'node size not match, {} != {}'.format(
      #     self._node_size, weak_child._node_size
      # )
      assert self._node_data_size == weak_child._node_data_size
      splits = self._splits.join(
          weak_child._splits,
          lambda x, y: x.compute_child_splits(y, mapping),
      )
      return DistributedHistogram(
          splits,
          weak_child._k,
          len(mapping) * 2,
          weak_child._node_data_size,
          weak_child._global_seed,
          weak_child._seed,
      )
  
imports: import logging
  import typing
  from typing import List, MutableMapping, Tuple, Optional
  import torch
  from fate.arch.computing.api import KVTable
  from ._histogram_local import Histogram
  from ._histogram_splits import HistogramSplits
  from .indexer import HistogramIndexer, Shuffler
label_desc: Use image node_id 7 for calling the DistributedHistogram obj's underlying member method code with example usage: obj.compute_child(weak_child, mapping) and returns: DistributedHistogram