code: def reduce_implementation(
      self, reduce_op, per_replica_value, destinations
  ):
      if tf_cross_device_ops.check_destinations(destinations):
          devices = tf_cross_device_ops.get_devices_from(destinations)
      else:
          devices = tf_cross_device_ops.get_devices_from(
              per_replica_value
          )
      reduce_to_device = devices[0]
      logging.log_first_n(
          logging.INFO, "Using byteps push pull to aggregate values", 1
      )
      reduced = _simple_reduce(
          per_replica_value,
          reduce_to_device,
          self.accumulation_fn,
          reduce_op,
      )
      if size() > 1:
          reduced = _push_pull(reduced)
      return reduced
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import enum
  import six
  from tensorflow.python.client import device_lib
  from tensorflow.python.distribute import cross_device_utils
  from tensorflow.python.distribute import device_util
  from tensorflow.python.distribute import reduce_util
  from tensorflow.python.distribute import values
  from tensorflow.python.eager import context
  from tensorflow.python.framework import kernels
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util.tf_export import tf_export
  from tensorflow.tools.docs import doc_controls
  import tensorflow
  from tensorflow.python.distribute.cross_device_ops import CollectiveAllReduce
  import tensorflow.python.distribute.cross_device_ops
  from byteps.tensorflow.ops import broadcast, _push_pull
  from byteps.tensorflow import local_rank, size
label_desc: Use image node_id 2 for calling the BytepsCrossDeviceOps obj's underlying member method code with example usage: obj.reduce_implementation(reduce_op, per_replica_value, destinations) and returns: reduced