class_docstr: Create a heterogeneous embedding table.
  
  It internally contains multiple ``torch.nn.Embedding`` with different dictionary sizes.
  
  Parameters
  ----------
  num_embeddings : dict[key, int]
      Size of the dictionaries. A key can be a string or a tuple of strings.
  embedding_dim : int
      Size of each embedding vector.
  
  Examples
  --------
  
  >>> import dgl
  >>> import torch
  >>> from dgl.nn import HeteroEmbedding
  
  >>> layer = HeteroEmbedding({'user': 2, ('user', 'follows', 'user'): 3}, 4)
  >>> # Get the heterogeneous embedding table
  >>> embeds = layer.weight
  >>> print(embeds['user'].shape)
  torch.Size([2, 4])
  >>> print(embeds[('user', 'follows', 'user')].shape)
  torch.Size([3, 4])
  
  >>> # Get the embeddings for a subset
  >>> input_ids = {'user': torch.LongTensor([0]),
  ...              ('user', 'follows', 'user'): torch.LongTensor([0, 2])}
  >>> embeds = layer(input_ids)
  >>> print(embeds['user'].shape)
  torch.Size([1, 4])
  >>> print(embeds[('user', 'follows', 'user')].shape)
  torch.Size([2, 4])
class_docstr_tok: ["Create","a","heterogeneous","embedding","table",".","It","internally","contains","multiple","``","torch.nn.Embedding","``","with","different","dictionary","sizes",".","Parameters","--","--","--","--","--","num_embeddings",":","dict","[","key",",","int","]","Size","of","the","dictionaries",".","A","key","can","be","a","string","or","a","tuple","of","strings",".","embedding_dim",":","int","Size","of","each","embedding","vector",".","Examples","--","--","--","--",">",">",">","import","dgl",">",">",">","import","torch",">",">",">","from","dgl.nn","import","HeteroEmbedding",">",">",">","layer","=","HeteroEmbedding","(","{","'user","'",":","2",",","(","'user","'",",","'follows","'",",","'user","'",")",":","3","}",",","4",")",">",">",">","#","Get","the","heterogeneous","embedding","table",">",">",">","embeds","=","layer.weight",">",">",">","print","(","embeds","[","'user","'","]",".shape",")","torch.Size","(","[","2",",","4","]",")",">",">",">","print","(","embeds","[","(","'user","'",",","'follows","'",",","'user","'",")","]",".shape",")","torch.Size","(","[","3",",","4","]",")",">",">",">","#","Get","the","embeddings","for","a","subset",">",">",">","input_ids","=","{","'user","'",":","torch.LongTensor","(","[","0","]",")",",","...","(","'user","'",",","'follows","'",",","'user","'",")",":","torch.LongTensor","(","[","0",",","2","]",")","}",">",">",">","embeds","=","layer","(","input_ids",")",">",">",">","print","(","embeds","[","'user","'","]",".shape",")","torch.Size","(","[","1",",","4","]",")",">",">",">","print","(","embeds","[","(","'user","'",",","'follows","'",",","'user","'",")","]",".shape",")","torch.Size","(","[","2",",","4","]",")"]
docstr: Forward function
  
  Parameters
  ----------
  input_ids : dict[key, Tensor]
      The row IDs to retrieve embeddings. It maps a key to key-specific IDs.
  
  Returns
  -------
  dict[key, Tensor]
      The retrieved embeddings.
docstr_tok: ["Forward","function","Parameters","--","--","--","--","--","input_ids",":","dict","[","key",",","Tensor","]","The","row","IDs","to","retrieve","embeddings",".","It","maps","a","key","to","key-specific","IDs",".","Returns","--","--","--","-","dict","[","key",",","Tensor","]","The","retrieved","embeddings","."]
code: def forward(self, input_ids):
      """Forward function
  
      Parameters
      ----------
      input_ids : dict[key, Tensor]
          The row IDs to retrieve embeddings. It maps a key to key-specific IDs.
  
      Returns
      -------
      dict[key, Tensor]
          The retrieved embeddings.
      """
      embeds = dict()
      for typ, typ_ids in input_ids.items():
          embeds[typ] = self.embeds[str(typ)](typ_ids)
  
      return embeds
  
imports: from functools import partial
  import torch
  import torch.nn
  from ...base import DGLError
label_desc: Use image node_id 4 for calling the HeteroEmbedding obj's underlying member method code with example usage: obj.forward(input_ids) and returns: embeds