code: def __init__(self, prior, nphi, _chunksize=int(1e6)):
      self.prior = prior
      self.nphi = nphi
      self.device = nphi.device
      self._sum_by_parts = lambda map_fn: functools.reduce(
          torch.add,
          [
              map_fn(slice(i, min(i + _chunksize, nphi.shape[1]))).sum(
                  1
              )
              for i in list(range(0, nphi.shape[1], _chunksize))
          ],
      )
  
imports: import collections
  import functools
  import io
  import os
  import warnings
  import dgl
  import numpy
  import scipy
  import torch
label_desc: Use image node_id 1 to create a new _Dirichlet object  with example: obj = _Dirichlet(prior, nphi, _chunksize)