code: def compute_hist(
      self,
      nodes: List[Node],
      bin_train_data=None,
      gh=None,
      sample_pos: DataFrame = None,
      node_map={},
      debug=False,
  ):
      grouped = (
          sample_pos.as_pd_df()
          .groupby("node_idx")["sample_id"]
          .apply(np.array)
          .apply(np.uint32)
      )
      data_indices = [None for i in range(len(nodes))]
      inverse_node_map = {v: k for k, v in node_map.items()}
      for idx, node in enumerate(nodes):
          data_indices[idx] = grouped[inverse_node_map[idx]]
  
      hists = []
      idx = 0
      for node in nodes:
          hist = self.hist_builder.compute_histograms_brute(
              data_indices[idx]
          )
          hist_arr = np.array(hist)
          g = hist_arr["sum_gradients"].cumsum(axis=1)
          h = hist_arr["sum_hessians"].cumsum(axis=1)
          count = hist_arr["count"].cumsum(axis=1)
          hists.append([g, h, count])
          idx += 1
  
      if debug:
          return hists, data_indices
      else:
          return hists
  
imports: import typing
  import torch
  from typing import Dict
  from fate.arch.histogram import HistogramBuilder, DistributedHistogram
  from fate.ml.ensemble.learner.decision_tree.tree_core.decision_tree import Node
  from typing import List
  import numpy
  from fate.arch.dataframe import DataFrame
  from fate.arch import Context
  import logging
label_desc: Use image node_id 2 for calling the SklearnHistBuilder obj's underlying member method code with example usage: obj.compute_hist(nodes, bin_train_data, gh, sample_pos, node_map, debug) and returns: hists,  data_indices, hists