class_docstr: Language model head that shares the same parameters with the embedding matrix.
class_docstr_tok: ["Language","model","head","that","shares","the","same","parameters","with","the","embedding","matrix","."]
code: def __init__(
      self,
      embed=None,
      embed_dim=None,
      vocab_size=None,
      dtype=None,
  ):
      super().__init__()
      if embed is not None:
          self.head = embed
          self.synced_embed = True
      else:
          # self.embedding = HiddenParallelEmbedding1D(vocab_size, hidden_size, dtype, padding_idx)
          # (hidden_size/q, vocab_size)
          self.synced_embed = False
          self.head = Linear1D_Row(
              in_features=embed_dim,
              out_features=vocab_size,
              bias=False,
              dtype=dtype,
              parallel_input=False,
          )
  
imports: import torch
  import torch.nn.init
  from torch import Tensor
  from torch import nn
  from torch.nn import functional
  from torch.nn.parameter import Parameter
  from colossalai.legacy.context import ParallelMode, seed
  from colossalai.legacy.core import global_context
  from colossalai.legacy.nn.layer.base_layer import ParallelLayer
  from colossalai.legacy.nn.layer.parallel_1d._utils import gather_forward_split_backward, reduce_grad, reduce_input
  from colossalai.legacy.nn.layer.parallel_1d.layers import Linear1D_Row
  from colossalai.legacy.nn.layer.utils import divide
  from colossalai.legacy.registry import LAYERS, LOSSES
  from colossalai.utils import get_current_device
label_desc: Use image node_id 1 to create a new HiddenParallelGPTLMHead1D object from inherited base classes: ParallelLayer with example: obj = HiddenParallelGPTLMHead1D(embed, embed_dim, vocab_size, dtype)