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","]",")"]
code: def __init__(self, num_embeddings, embedding_dim):
      super(HeteroEmbedding, self).__init__()
  
      self.embeds = nn.ModuleDict()
      self.raw_keys = dict()
      for typ, typ_num_rows in num_embeddings.items():
          self.embeds[str(typ)] = nn.Embedding(
              typ_num_rows, embedding_dim
          )
          self.raw_keys[str(typ)] = typ
  
imports: from functools import partial
  import torch
  import torch.nn
  from ...base import DGLError
label_desc: Use image node_id 1 to create a new HeteroEmbedding object from inherited base classes: nn with example: obj = HeteroEmbedding(num_embeddings, embedding_dim)