code: def _max_helper_double_log_reduction(enc_tensor, dim=None):
      """Returns max along dim `dim` using the double_log_reduction algorithm"""
      if enc_tensor.dim() == 0:
          return enc_tensor
      input, dim_used, size_arr = enc_tensor, dim, ()
      if dim is None:
          dim_used = 0
          input = enc_tensor.flatten()
      # turn dim_used into a positive number
      dim_used = dim_used + input.dim() if dim_used < 0 else dim_used
      if input.dim() > 1:
          size_arr = [
              input.size(i) for i in range(input.dim()) if i != dim_used
          ]
      # add another dimension to vectorize double log reductions
      input = input.unsqueeze(dim_used + 1)
      enc_max_val = _max_helper_double_log_recursive(input, dim_used)
      enc_max_val = enc_max_val.squeeze(dim_used + 1)
      enc_max_val = enc_max_val.reshape(size_arr)
      return enc_max_val
  
file_path: FATE/python/fate/arch/protocol/mpc/functions/maximum.py
imports: import math
  import torch
  from fate.arch.protocol import mpc
  from fate.arch.protocol.mpc.config import cfg
label_desc: Use image node_id 9 for calling a global function with example usage: _max_helper_double_log_reduction(enc_tensor, dim) and returns: enc_max_val, enc_tensor