code: def _max_helper_log_reduction(enc_tensor, dim=None):
      """Returns max along dim `dim` using the log_reduction algorithm"""
      if enc_tensor.dim() == 0:
          return enc_tensor
      input, dim_used = enc_tensor, dim
      if dim is None:
          dim_used = 0
          input = enc_tensor.flatten()
      n = input.size(dim_used)  # number of items in the dimension
      steps = int(math.log(n))
      enc_tensor_reduced = _compute_pairwise_comparisons_for_steps(
          input, dim_used, steps
      )
  
      # compute max over the resulting reduced tensor with n^2 algorithm
      # note that the resulting one-hot vector we get here finds maxes only
      # over the reduced vector in enc_tensor_reduced, so we won't use it
      with cfg.temp_override({"functions.max_method": "pairwise"}):
          enc_max_vec, enc_one_hot_reduced = enc_tensor_reduced.max(
              dim=dim_used
          )
      return enc_max_vec
  
file_path: CrypTen/crypten/common/functions/maximum.py
imports: import math
  import crypten
  import torch
  from crypten.config import cfg
label_desc: Use image node_id 7 for calling a global function with example usage: _max_helper_log_reduction(enc_tensor, dim) and returns: enc_max_vec, enc_tensor