code: def top_k_experts(x, k, hparams):
      x_shape = common_layers.shape_list(x)
      x_flat = tf.reshape(x, [-1, common_layers.shape_list(x)[-1]])
      is_training = hparams.mode == tf_estimator.ModeKeys.TRAIN
      gates, load = expert_utils.noisy_top_k_gating(
          x_flat, 2**hparams.z_size, is_training, k
      )
      gates_shape = [
          x_shape[0],
          x_shape[1],
          x_shape[2],
          2**hparams.z_size,
      ]
      gates = tf.reshape(gates, gates_shape)
      load_loss = expert_utils.cv_squared(load)
      return gates, load_loss
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import math
  import os
  from six.moves import range
  from tensor2tensor.layers import common_attention
  from tensor2tensor.layers import common_image_attention
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import discretization
  from tensor2tensor.layers import latent_layers
  from tensor2tensor.layers import modalities
  from tensor2tensor.models import transformer
  from tensor2tensor.utils import beam_search
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import expert_utils
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import t2t_model
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 5 for calling a global function with example usage: top_k_experts(x, k, hparams) and returns: gates,  load_loss