code: def testSymbolModalityInputs(self):
      batch_size = 10
      num_datashards = 5
      length = 5
      vocab_size = 5000
      hidden_size = 9
      model_hparams = common_hparams.basic_params1()
      model_hparams.hidden_size = hidden_size
      model_hparams.mode = tf_estimator.ModeKeys.TRAIN
      x = np.random.randint(vocab_size, size=(batch_size, length, 1, 1))
      data_parallelism = expert_utils.Parallelism(
          ["/device:CPU:0"] * num_datashards
      )
      xs = tf.split(x, num_datashards)
      sharded_output = data_parallelism(
          modalities.get_bottom(modalities.ModalityType.SYMBOL),
          xs,
          model_hparams,
          vocab_size,
      )
      output = tf.concat(sharded_output, 0)
      self.evaluate(tf.global_variables_initializer())
      res = self.evaluate(output)
      self.assertEqual(res.shape, (batch_size, length, 1, hidden_size))
  
file_path: tensor2tensor/tensor2tensor/layers/modalities_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from tensor2tensor.layers import common_hparams
  from tensor2tensor.layers import modalities
  from tensor2tensor.utils import expert_utils
  from tensor2tensor.utils import test_utils
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 2 for calling the ModalityTest obj's underlying member method code with example usage: obj.testSymbolModalityInputs() without return types