docstr: Args:
      x (:obj:`torch.Tensor` of shape ``(batch, seq_len, dim_in)``): The input of linear layer
  Returns:
      :obj:`torch.Tensor` of shape ``(batch, seq_len, dim_out)``: The output of the linear transform y.
docstr_tok: ["Args",":","x","(",":","obj",":","`","torch.Tensor","`","of","shape","``","(","batch",",","seq_len",",","dim_in",")","``",")",":","The","input","of","linear","layer","Returns",":",":","obj",":","`","torch.Tensor","`","of","shape","``","(","batch",",","seq_len",",","dim_out",")","``",":","The","output","of","the","linear","transform","y","."]
code: def forward(self, x: torch.Tensor):
      """
      Args:
          x (:obj:`torch.Tensor` of shape ``(batch, seq_len, dim_in)``): The input of linear layer
      Returns:
          :obj:`torch.Tensor` of shape ``(batch, seq_len, dim_out)``: The output of the linear transform y.
      """  # noqa: E501
      if self.scale_before:
          x = x / math.sqrt(self.dim_in)
          x = F.linear(x, self.weight)
      else:
          x = F.linear(x, self.weight)
          x = x / math.sqrt(self.dim_in)
      return x
  
file_path: DeepKE/example/llm/CPM-Bee/src/cpm_live/layers/linear.py
imports: import torch
  import bmtrain
  import math
  import torch.nn.functional
label_desc: Use image node_id 2 for calling the Linear obj's underlying member method code with example usage: obj.forward(x) and returns: x