class_docstr: Classifier layer of colossalai.
  
  Args:
      in_features (int): size of each input sample.
      num_classes (int): number of classes.
      weight (:class:`torch.nn.Parameter`, optional): weight of the classifier, defaults to None.
      bias (bool, optional): If set to ``False``, the layer will not learn an additive bias, defaults to ``True``.
      dtype (:class:`torch.dtype`, optional): The dtype of parameters, defaults to None.
      weight_initializer (:class:`typing.Callable`, optional):
          The initializer of weight, defaults to kaiming uniform initializer.
      bias_initializer (:class:`typing.Callable`, optional):
          The initializer of bias, defaults to xavier uniform initializer.
  
  More details about ``initializer`` please refer to
  `init <https://github.com/hpcaitech/ColossalAI/blob/main/colossalai/nn/init.py>`_.
class_docstr_tok: ["Classifier","layer","of","colossalai",".","Args",":","in_features","(","int",")",":","size","of","each","input","sample",".","num_classes","(","int",")",":","number","of","classes",".","weight","(",":","class",":","`","torch.nn.Parameter","`",",","optional",")",":","weight","of","the","classifier",",","defaults","to","None",".","bias","(","bool",",","optional",")",":","If","set","to","``","False","``",",","the","layer","will","not","learn","an","additive","bias",",","defaults","to","``","True","``",".","dtype","(",":","class",":","`","torch.dtype","`",",","optional",")",":","The","dtype","of","parameters",",","defaults","to","None",".","weight_initializer","(",":","class",":","`","typing.Callable","`",",","optional",")",":","The","initializer","of","weight",",","defaults","to","kaiming","uniform","initializer",".","bias_initializer","(",":","class",":","`","typing.Callable","`",",","optional",")",":","The","initializer","of","bias",",","defaults","to","xavier","uniform","initializer",".","More","details","about","``","initializer","``","please","refer","to","`","init","<","https",":","\/\/github.com\/hpcaitech\/ColossalAI\/blob\/main\/colossalai\/nn\/init.py",">","`","_","."]
code: def __init__(
      self,
      in_features: int,
      num_classes: int,
      weight: nn.Parameter = None,
      bias: bool = True,
      dtype: dtype = None,
      weight_initializer: Callable = init.kaiming_uniform_(
          a=math.sqrt(5)
      ),
      bias_initializer: Callable = init.xavier_uniform_(a=1, scale=1),
      vocab_parallel_limit: int = 2048,
  ) -> None:
      tensor_parallel = get_tensor_parallel_mode()
      if num_classes <= vocab_parallel_limit or tensor_parallel is None:
          layer = _parallel_classifier[tensor_parallel](
              in_features,
              num_classes,
              weight=weight,
              bias=bias,
              dtype=dtype,
              weight_initializer=weight_initializer,
              bias_initializer=bias_initializer,
          )
      else:
          layer = _vocab_parallel_classifier[tensor_parallel](
              in_features,
              num_classes,
              weight=weight,
              bias=bias,
              dtype=dtype,
              weight_initializer=weight_initializer,
              bias_initializer=bias_initializer,
          )
      super().__init__(layer)
  
file_path: ColossalAI/colossalai/legacy/nn/layer/colossalai_layer/linear.py
imports: import inspect
  import math
  from typing import Callable
  from torch import dtype, nn
  from colossalai.nn import init
  from ..parallel_1d import *
  from ..parallel_2d import *
  from ..parallel_2p5d import *
  from ..parallel_3d import *
  from ..utils import get_tensor_parallel_mode
  from ..vanilla import *
  from ._utils import ColossalaiModule
label_desc: Use image node_id 1 to create a new Classifier object from inherited base classes: ColossalaiModule with example: obj = Classifier(in_features, num_classes, weight, bias, dtype, weight_initializer, bias_initializer, vocab_parallel_limit)