class_docstr: Applies a linear transformation to the input data
  
  Args:
      in_features (int): number of features in the input tensor
      out_features (int): number of features in the output tensor
      bias  (Optional[bool]): use bias or not
      channel_first (Optional[bool]): Channels are first or last dimension. If first, then use Conv2d
  
  Shape:
      - Input: :math:`(N, *, C_{in})` if not channel_first else :math:`(N, C_{in}, *)` where :math:`*` means any number of dimensions.
      - Output: :math:`(N, *, C_{out})` if not channel_first else :math:`(N, C_{out}, *)`
class_docstr_tok: ["Applies","a","linear","transformation","to","the","input","data","Args",":","in_features","(","int",")",":","number","of","features","in","the","input","tensor","out_features","(","int",")",":","number","of","features","in","the","output","tensor","bias","(","Optional","[","bool","]",")",":","use","bias","or","not","channel_first","(","Optional","[","bool","]",")",":","Channels","are","first","or","last","dimension",".","If","first",",","then","use","Conv2d","Shape",":","-","Input",":",":","math",":","`","(","N",",","*",",","C_","{","in","}",")","`","if","not","channel_first","else",":","math",":","`","(","N",",","C_","{","in","}",",","*",")","`","where",":","math",":","`","*","`","means","any","number","of","dimensions",".","-","Output",":",":","math",":","`","(","N",",","*",",","C_","{","out","}",")","`","if","not","channel_first","else",":","math",":","`","(","N",",","C_","{","out","}",",","*",")","`"]
code: def forward(self, x: Tensor) -> Tensor:
      if self.channel_first:
          if not self.training:
              logger.error(
                  "Channel-first mode is only supported during inference"
              )
          if x.dim() != 4:
              logger.error(
                  "Input should be 4D, i.e., (B, C, H, W) format"
              )
          # only run during conversion
          with torch.no_grad():
              return F.conv2d(
                  input=x,
                  weight=self.weight.clone()
                  .detach()
                  .reshape(self.out_features, self.in_features, 1, 1),
                  bias=self.bias,
              )
      else:
          x = F.linear(x, weight=self.weight, bias=self.bias)
      return x
  
imports: import argparse
  from typing import Optional
  import torch
  from torch import Tensor, nn
  from torch.nn import functional
  from cvnets.layers.base_layer import BaseLayer
  from utils import logger
label_desc: Use image node_id 4 for calling the LinearLayer obj's underlying member method code with example usage: obj.forward(x) and returns: x, F