code: def embedding_dim(vocab_size: int):
      """Calculate a reasonable embedding size for a vocabulary.
  
      Rule of thumb is ``6 * sqrt(sqrt(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))))
  
file_path: sonnet/sonnet/src/embed.py
imports: import math
  from typing import Optional
  from sonnet.src import base
  from sonnet.src import initializers
  from sonnet.src import types
  import tensorflow
label_desc: Use image node_id 1 for calling a global function with example usage: embedding_dim(vocab_size) and returns: int