code: def get_weights(model_hparams, vocab_size, hidden_dim=None):
    
    if hidden_dim is None:
      hidden_dim = model_hparams.hidden_size
    num_shards = model_hparams.symbol_modality_num_shards
    shards = []
    for i in range(num_shards):
      shard_size = (vocab_size // num_shards) + (
          1 if i < vocab_size % num_shards else 0)
      var_name = "weights_%d" % i
      shards.append(
          tf.get_variable(
              var_name, [shard_size, hidden_dim],
              initializer=tf.random_normal_initializer(0.0, hidden_dim**-0.5)))
    if num_shards == 1:
      ret = shards[0]
    else:
      ret = tf.concat(shards, 0)
    # Convert ret to tensor.
    if not tf.executing_eagerly():
      ret = common_layers.convert_gradient_to_tensor(ret)
    return ret
docs: Create or get concatenated embedding or softmax variable.
  
    Args:
      model_hparams: HParams, model hyperparmeters.
      vocab_size: int, vocabulary size.
      hidden_dim: dim of the variable. Defaults to _model_hparams' hidden_size
  
    Returns:
       a list of num_shards Tensors.