code: def broadcast_variables(variables, root_rank, scope=""):
      """Broadcasts variables from root rank to all other processes.
      Arguments:
          variables: variables for broadcast
          root_rank: rank of the process from which global variables will be broadcasted
                     to all other processes.
          scope: the graph name scope
      """
      if size() <= 1:
          return tf.group(*variables)
      _assign = (
          tf.assign if hasattr(tf, "assign") else tf.compat.v1.assign
      )
      return tf.group(
          *[
              _assign(var, broadcast(var, root_rank, scope))
              for var in variables
          ]
      )
  
file_path: byteps/byteps/tensorflow/__init__.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import warnings
  from byteps.tensorflow.compression import Compression
  from byteps.tensorflow.ops import broadcast, _push_pull
  from byteps.tensorflow.ops import init, shutdown, suspend, resume, get_pushpull_speed
  from byteps.tensorflow.ops import size, local_size, rank, local_rank
  from byteps.tensorflow.ops import handle_average_backwards_compatibility
  from byteps.tensorflow.util import _executing_eagerly
  import tensorflow
  from tensorflow.python.ops import control_flow_ops
label_desc: Use image node_id 2 for calling a global function with example usage: broadcast_variables(variables, root_rank, scope) and returns: tf, tf