code: def _max_helper_all_tree_reductions(
      enc_tensor, dim=None, method="log_reduction"
  ):
      """
      Finds the max along `dim` using the specified reduction method. `method`
      can be one of [`log_reduction`, `double_log_reduction`, 'accelerated_cascade`]
      `log_reduction`: Uses O(n) comparisons and O(log n) rounds of communication
      `double_log_reduction`: Uses O(n loglog n) comparisons and O(loglog n) rounds
      of communication (Section 2.6.2 in https://folk.idi.ntnu.no/mlh/algkon/jaja.pdf)
      `accelerated_cascade`: Uses O(n) comparisons and O(loglog n) rounds of
      communication. (See Section 2.6.3 of https://folk.idi.ntnu.no/mlh/algkon/jaja.pdf)
      """
      if method == "log_reduction":
          return _max_helper_log_reduction(enc_tensor, dim)
      elif method == "double_log_reduction":
          return _max_helper_double_log_reduction(enc_tensor, dim)
      elif method == "accelerated_cascade":
          return _max_helper_accelerated_cascade(enc_tensor, dim)
      else:
          raise RuntimeError("Unknown max method")
  
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 11 for calling a global function with example usage: _max_helper_all_tree_reductions(enc_tensor, dim, method) and returns: _max_helper_log_reduction, _max_helper_double_log_reduction, _max_helper_accelerated_cascade