class_docstr: Applies a linear transformation to incoming data using weights and bias.
  
  Unless overridden by a subclass, the weights and bias are initialized from
  :math:`\mathcal{U}(-\sqrt{k}, \sqrt{k})`, where
  :math:`k = \frac{1}{\text{input_dim}}`.
  
  .. note::
      This class is identical to :class:`torch.nn.Linear`.
class_docstr_tok: ["Applies","a","linear","transformation","to","incoming","data","using","weights","and","bias",".","Unless","overridden","by","a","subclass",",","the","weights","and","bias","are","initialized","from",":","math",":","`","\\mathcal","{","U","}","(","-\\sqrt","{","k","}",",","\\sqrt","{","k","}",")","`",",","where",":","math",":","`","k","=","\\frac","{","1","}","{","\\text","{","input_dim","}","}","`",".","..","note",":",":","This","class","is","identical","to",":","class",":","`","torch.nn.Linear","`","."]
docstr: :param input_dim:
      The dimensionality of inputs.
  :param output_dim:
      The dimensionality of projected outputs.
  :param bias:
      If ``True``, learns an additive bias.
  :param init_fn:
      The callable to use for parameter initialization.
docstr_tok: [":","param","input_dim",":","The","dimensionality","of","inputs",".",":","param","output_dim",":","The","dimensionality","of","projected","outputs",".",":","param","bias",":","If","``","True","``",",","learns","an","additive","bias",".",":","param","init_fn",":","The","callable","to","use","for","parameter","initialization","."]
code: def __init__(
      self,
      input_dim: int,
      output_dim: int,
      bias: bool,
      *,
      init_fn: Optional[Callable[[Linear], None]] = None,
      device: Optional[Device] = None,
      dtype: Optional[DataType] = None,
  ) -> None:
      """
      :param input_dim:
          The dimensionality of inputs.
      :param output_dim:
          The dimensionality of projected outputs.
      :param bias:
          If ``True``, learns an additive bias.
      :param init_fn:
          The callable to use for parameter initialization.
      """
      super().__init__(input_dim, output_dim)
  
      self.weight = Parameter(
          torch.empty(
              (output_dim, input_dim), device=device, dtype=dtype
          )
      )
  
      if bias:
          self.bias = Parameter(
              torch.empty((output_dim,), device=device, dtype=dtype)
          )
      else:
          self.register_parameter("bias", None)
  
      self.init_fn = init_fn
  
      self.reset_parameters()
  
imports: from __future__ import annotations
  import math
  from abc import ABC, abstractmethod
  from typing import Callable, Optional, final
  import torch
  import torch.nn
  from torch import Tensor
  from torch.nn import Module
  from torch.nn.functional import linear
  from torch.nn.parameter import Parameter
  from fairseq2.typing import DataType, Device, finaloverride
label_desc: Use image node_id 1 to create a new Linear object from inherited base classes: Projection with example: obj = Linear(input_dim, output_dim, bias)