code: def sumexp_stable(data):
      
      max_value = data.max(axis=0)
      result_exp = np.exp(data - max_value)
      result_sum = np.sum(result_exp, axis=0)
      return result_sum, max_value, result_exp
docs: Compute the sum of exponents for a list of samples
  
      Parameters
      ----------
  
      data : array, shape=[features, samples]
          A data array containing samples.
  
  
      Returns
      -------
  
      result_sum : array, shape=[samples,]
          The sum of exponents for each sample divided by the exponent
          of the maximum feature value in the sample.
  
      max_value : array, shape=[samples,]
          The maximum feature value for each sample.
  
      result_exp : array, shape=[features, samples]
          The exponent of each element in each sample divided by the exponent
          of the maximum feature value in the sample.
  
      Note
      ----
  
          This function is more stable than computing the sum(exp(v)).
          It useful for computing the softmax_i(v)=exp(v_i)/sum(exp(v)) function.