class_docstr: Switch layer of Neural Shuffle-Exchange network.
docstr: Split inputs in half and then shuffle them as described in paper.
  
  Args:
    inputs: ShuffleLayer inputs
  Return:
    tf.Tensor: Inputs with swapped halves
docstr_tok: ["Split","inputs","in","half","and","then","shuffle","them","as","described","in","paper",".","Args",":","inputs",":","ShuffleLayer","inputs","Return",":","tf.Tensor",":","Inputs","with","swapped","halves"]
code: def swap_halves(self, inputs):
      """Split inputs in half and then shuffle them as described in paper.
  
      Args:
        inputs: ShuffleLayer inputs
      Return:
        tf.Tensor: Inputs with swapped halves
      """
      x = tf.range(0, self.length)
      xor_indices = tf.bitwise.bitwise_xor(x, 1)
      input_xor = tf.gather(
          inputs[:, :, : self.num_units // 2], xor_indices, axis=1
      )
      return tf.concat(
          [input_xor, inputs[:, :, self.num_units // 2 :]], axis=2
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  from tensor2tensor.layers import common_hparams
  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 the SwitchLayer obj's underlying member method code with example usage: obj.swap_halves(inputs) and returns: tf