code: def testCollectiveReduceMinMax(self):
      self._setup_context()
  
      @def_function.function
      def run_all_reduce(group_key, instance_key, merge_op):
          t0 = [1.0, 20.0, 3.0, 40.0, 5.0]
          t1 = [10.0, 2.0, 30.0, 4.0, 50.0]
          with ops.device("/GPU:0"):
              in0 = constant_op.constant(t0)
              c0 = collective_ops.all_reduce(
                  in0,
                  self._group_size,
                  group_key,
                  instance_key,
                  merge_op,
                  final_op="Id",
                  communication_hint="nccl",
              )
          with ops.device("/GPU:1"):
              in1 = constant_op.constant(t1)
              c1 = collective_ops.all_reduce(
                  in1,
                  self._group_size,
                  group_key,
                  instance_key,
                  merge_op,
                  final_op="Id",
                  communication_hint="nccl",
              )
          return c0, c1
  
      for combination in [
          ("Max", [10.0, 20.0, 30.0, 40.0, 50.0]),
          ("Min", [1.0, 2.0, 3.0, 4.0, 5.0]),
      ]:
          merge_op = combination[0]
          results = run_all_reduce(
              group_key=10, instance_key=20, merge_op=merge_op
          )
          expected = combination[1]
          for result in results:
              self.assertAllClose(
                  result, expected, rtol=1e-5, atol=1e-5
              )
  
imports: import os
  import threading
  import time
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import config
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import collective_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 12 for calling the CollectiveOpGPUTest obj's underlying member method code with example usage: obj.testCollectiveReduceMinMax() and returns: c0,  c1