code: def get_stats(
      array, conf_interval=False, name=None, stdout=False, logout=False
  ):
      """Compute mean and standard deviation from an numerical array
  
      Args:
          array (array like obj): The numerical array, this array can be
              convert to :obj:`torch.Tensor`.
          conf_interval (bool, optional): If True, compute the confidence interval bound (95%)
              instead of the std value. (default: :obj:`False`)
          name (str, optional): The name of this numerical array, for log usage.
              (default: :obj:`None`)
          stdout (bool, optional): Whether to output result to the terminal.
              (default: :obj:`False`)
          logout (bool, optional): Whether to output result via logging module.
              (default: :obj:`False`)
      """
      eps = 1e-9
      array = torch.Tensor(array)
      std, mean = torch.std_mean(array)
      std = std.item()
      mean = mean.item()
      center = mean
  
      if conf_interval:
          n = array.size(0)
          se = std / (math.sqrt(n) + eps)
          t_value = t.ppf(0.975, df=n - 1)
          err_bound = t_value * se
      else:
          err_bound = std
  
      # log and print
      if name is None:
          name = "array {}".format(id(array))
      log = "{}: {:.4f}(+-{:.4f})".format(name, center, err_bound)
      if stdout:
          print(log)
      if logout:
          logging.info(log)
  
      return center, err_bound
  
file_path: dgl/examples/pytorch/gxn/utils.py
imports: import argparse
  import logging
  import math
  import os
  import random
  import numpy
  import torch
  import torch.cuda
  from scipy.stats import t
label_desc: Use image node_id 1 for calling a global function with example usage: get_stats(array, conf_interval, name, stdout, logout) and returns: center,  err_bound