code: def _compute_amax_percentile(calib_hist, calib_bin_edges, percentile):
      """Returns amax that clips the percentile fraction of collected data"""
  
      if percentile < 0 or percentile > 100:
          raise ValueError(
              "Invalid percentile. Must be in range 0 <= percentile <= 100."
          )
  
      # If calibrator hasn't collected any data, return none
      if calib_bin_edges is None and calib_hist is None:
          return None
  
      total = calib_hist.sum()
      cdf = np.cumsum(calib_hist / total)
      idx = np.searchsorted(cdf, percentile / 100)
      calib_amax = calib_bin_edges[idx]
      calib_amax = torch.tensor(
          calib_amax.item()
      )  # pylint: disable=not-callable
  
      return calib_amax
  
imports: from collections import Counter
  import numpy
  from scipy.stats import entropy
  import logging
  import torch
  from lightseq.training.pytorch_quantization.calib.calibrator import _Calibrator
  from lightseq.training.pytorch_quantization.tensor_quant import fake_tensor_quant
  from lightseq.training.pytorch_quantization import nn
  from lightseq.training.pytorch_quantization import utils
label_desc: Use image node_id 3 for calling a global function with example usage: _compute_amax_percentile(calib_hist, calib_bin_edges, percentile) and returns: calib_amax, None