code: def embedding_matrix_on_device(
      vocab: List[str],
      embedding_size: int,
      representation: str = "dense",
      embeddings_trainable: bool = True,
      pretrained_embeddings: Optional[str] = None,
      force_embedding_size: bool = False,
      embeddings_on_cpu: bool = False,
      embedding_initializer: Optional[str] = None,
  ) -> Tuple[nn.Module, int]:
      embeddings, embedding_size = embedding_matrix(
          vocab,
          embedding_size,
          representation=representation,
          embeddings_trainable=embeddings_trainable,
          pretrained_embeddings=pretrained_embeddings,
          force_embedding_size=force_embedding_size,
          embedding_initializer=embedding_initializer,
      )
      if embeddings_on_cpu:
          embeddings.to("cpu")
      elif not embeddings_on_cpu and torch.cuda.is_available():
          embeddings.to(device="cuda")
  
      return embeddings, embedding_size
  
imports: import logging
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  from torch import nn
  from ludwig.constants import TYPE
  from ludwig.modules.initializer_modules import get_initializer
  from ludwig.utils.data_utils import load_pretrained_embeddings
  from ludwig.utils.torch_utils import get_torch_device, LudwigModule
label_desc: Use image node_id 2 for calling a global function with example usage: embedding_matrix_on_device(vocab, embedding_size, representation, embeddings_trainable, pretrained_embeddings, force_embedding_size, embeddings_on_cpu, embedding_initializer) and returns: embeddings,  embedding_size