code: def reduce_max(X, lengths, *, threads_per_block=128, num_blocks=128):
      _is_float_array(X)
  
      B = len(lengths)
      T = X.shape[0]
      O = X.shape[1]
  
      _check_lengths(lengths, T, min_length=1)
  
      out_shape = (B, O)
      maxes = _alloc(out_shape, dtype=X.dtype, zeros=False)
      which = _alloc(out_shape, dtype="i", zeros=False)
  
      if X.dtype == "float32":
          reduce_max_kernel_float(
              (num_blocks,),
              (threads_per_block,),
              (maxes, which, X, lengths, B, T, O),
          )
      else:
          reduce_max_kernel_double(
              (num_blocks,),
              (threads_per_block,),
              (maxes, which, X, lengths, B, T, O),
          )
  
      return maxes, which
  
imports: import operator
  import re
  from collections import defaultdict
  from functools import reduce
  from pathlib import Path
  from typing import Callable, Optional, Tuple
  import numpy
  from ..compat import cupy, has_cupy_gpu
label_desc: Use image node_id 15 for calling a global function with example usage: reduce_max(X, lengths) and returns: maxes,  which