docstr: get bin edges for a particular feature_key (e.g. node_degree)
  TODO: maybe sample for efficiency
  
  TODO: currently doing in numpy
  pytorch might support bucketization in future
  https://github.com/pytorch/pytorch/pull/34577
docstr_tok: ["get","bin","edges","for","a","particular","feature_key","(","e.g",".","node_degree",")","TODO",":","maybe","sample","for","efficiency","TODO",":","currently","doing","in","numpy","pytorch","might","support","bucketization","in","future","https",":","\/\/github.com\/pytorch\/pytorch\/pull\/34577"]
code: def _get_bin_edges(dataset, feature_key, feature_dim, bin_method):
      """
      get bin edges for a particular feature_key (e.g. node_degree)
      TODO: maybe sample for efficiency
  
      TODO: currently doing in numpy
      pytorch might support bucketization in future
      https://github.com/pytorch/pytorch/pull/34577
      """
      list_scalars = np.concatenate([g[feature_key] for g in dataset])
      if bin_method == "balanced":
          # bin by ensuring that the labels are roughly
          # balanced (except ties)
          arr = np.array(list_scalars)
          sorted_arr = np.sort(list_scalars)
          bin_indices = np.linspace(
              0, len(list_scalars), num=feature_dim, endpoint=False
          ).astype(int)
          bins = sorted_arr[bin_indices]
          unique_bins = np.unique(bins)
          if len(unique_bins) < len(bins):
              bins = unique_bins
              feature_dim = len(unique_bins)
              logging.warning(
                  "{} dimensions are collapsed due to balanced"
                  " binning".format(feature_key)
              )
  
      elif bin_method == "equal_width":
          # use bins of equal size
          arr = np.array(list_scalars)
          min_val, max_val = np.min(arr), np.max(arr)
          bins = np.linspace(min_val, max_val, num=feature_dim)
  
      elif bin_method == "bounded":
          # (only for integer features) upper-bound the values, and use bin
          # of width 1
          bins = np.arange(feature_dim)
      else:
          raise ValueError(
              "Bin method {} not supported".format(bin_method)
          )
      return bins
  
imports: import logging
  import networkx
  import numpy
  import torch
  import torch.nn
  from deepsnap.graph import Graph
  import graphgym.register
  from graphgym.config import cfg
  from graphgym.contrib.transform.identity import compute_identity
label_desc: Use image node_id 8 for calling the FeatureAugment obj's underlying member method code with example usage: obj._get_bin_edges(dataset, feature_key, feature_dim, bin_method) and returns: bins