class_docstr: BasicHead. No pool.
class_docstr_tok: ["BasicHead",".","No","pool","."]
docstr: Perform linear projection and activation as head for tranformers.
  Args:
      dim_in (`int`):
          The channel dimension of the input to the head.
      num_classes (`int`):
          The channel dimensions of the output to the head.
      dropout_rate (`float`):
          Dropout rate. If equal to 0.0, perform no
          dropout.
      act_func (`string`):
          Activation function to use.
          - "softmax": applies softmax on the output.
          - "sigmoid": applies sigmoid on the output.
docstr_tok: ["Perform","linear","projection","and","activation","as","head","for","tranformers",".","Args",":","dim_in","(","`","int","`",")",":","The","channel","dimension","of","the","input","to","the","head",".","num_classes","(","`","int","`",")",":","The","channel","dimensions","of","the","output","to","the","head",".","dropout_rate","(","`","float","`",")",":","Dropout","rate",".","If","equal","to","0.0",",","perform","no","dropout",".","act_func","(","`","string","`",")",":","Activation","function","to","use",".","-","``","softmax","''",":","applies","softmax","on","the","output",".","-","``","sigmoid","''",":","applies","sigmoid","on","the","output","."]
code: def __init__(
      self, dim_in, num_classes, dropout_rate=0.0, act_func="softmax"
  ):
      """
      Perform linear projection and activation as head for tranformers.
      Args:
          dim_in (`int`):
              The channel dimension of the input to the head.
          num_classes (`int`):
              The channel dimensions of the output to the head.
          dropout_rate (`float`):
              Dropout rate. If equal to 0.0, perform no
              dropout.
          act_func (`string`):
              Activation function to use.
              - "softmax": applies softmax on the output.
              - "sigmoid": applies sigmoid on the output.
      """
      super().__init__()
      if dropout_rate > 0.0:
          self.dropout = nn.Dropout(dropout_rate)
      self.projection = Linear(
          dim_in, num_classes, bias=True
      )  # pylint: disable=too-many-function-args,unexpected-keyword-arg
  
      # Softmax for evaluation and testing.
      if act_func == "softmax":
          self.act = Softmax(
              dim=1
          )  # pylint: disable=unexpected-keyword-arg
      elif act_func == "sigmoid":
          self.act = Sigmoid()
      else:
          raise NotImplementedError(
              f"{act_func} is not supported as an activation"
              "function."
          )
  
imports: import math
  from functools import partial
  from typing import Tuple, List
  import numpy
  import torch
  from torch import nn
  from torch.nn.init import trunc_normal_
  from einops import rearrange
  from towhee.models.layers.layers_with_relprop import GELU, Linear, Dropout, Conv2d, Conv3d, Softmax, Sigmoid, LayerNorm, Einsum, Add, Clone, MaxPool3d, IndexSelect
label_desc: Use image node_id 1 to create a new TransformerBasicHead object from inherited base classes: nn with example: obj = TransformerBasicHead(dim_in, num_classes, dropout_rate, act_func)