Calculate a reasonable embedding size for a vocabulary.

  Rule of thumb is 6 * 4th root of vocab_size.

  Args:
    vocab_size: Size of the input vocabulary.
  Returns:
    The embedding size to use.
  Raises:
    ValueError: if `vocab_size` is invalid.

def _embedding_dim(vocab_size):
  """Calculate a reasonable embedding size for a vocabulary.

  Rule of thumb is 6 * 4th root of vocab_size.

  Args:
    vocab_size: Size of the input vocabulary.
  Returns:
    The embedding size to use.
  Raises:
    ValueError: if `vocab_size` is invalid.
  """
  if not vocab_size or (vocab_size <= 0):
    raise ValueError("Invalid vocab_size %g." % vocab_size)
  return int(round(6.0 * math.sqrt(math.sqrt(vocab_size))))