class_docstr: Performs a linear transformation.
docstr: **Arguments:**
  
  - `in_features`: The input size. The input to the layer should be a vector of
      shape `(in_features,)`
  - `out_features`: The output size. The output from the layer will be a vector
      of shape `(out_features,)`.
  - `use_bias`: Whether to add on a bias as well.
  - `key`: A `jax.random.PRNGKey` used to provide randomness for parameter
      initialisation. (Keyword only argument.)
  
  Note that `in_features` also supports the string `"scalar"` as a special value.
  In this case the input to the layer should be of shape `()`.
  
  Likewise `out_features` can also be a string `"scalar"`, in which case the
  output from the layer will have shape `()`.
docstr_tok: ["*","*","Arguments",":","*","*","-","`","in_features","`",":","The","input","size",".","The","input","to","the","layer","should","be","a","vector","of","shape","`","(","in_features",",",")","`","-","`","out_features","`",":","The","output","size",".","The","output","from","the","layer","will","be","a","vector","of","shape","`","(","out_features",",",")","`",".","-","`","use_bias","`",":","Whether","to","add","on","a","bias","as","well",".","-","`","key","`",":","A","`","jax.random.PRNGKey","`","used","to","provide","randomness","for","parameter","initialisation",".","(","Keyword","only","argument",".",")","Note","that","`","in_features","`","also","supports","the","string","`","``","scalar","''","`","as","a","special","value",".","In","this","case","the","input","to","the","layer","should","be","of","shape","`","(",")","`",".","Likewise","`","out_features","`","can","also","be","a","string","`","``","scalar","''","`",",","in","which","case","the","output","from","the","layer","will","have","shape","`","(",")","`","."]
code: def __init__(
      self,
      in_features: Union[int, Literal["scalar"]],
      out_features: Union[int, Literal["scalar"]],
      use_bias: bool = True,
      *,
      key: PRNGKeyArray,
  ):
      """**Arguments:**
  
      - `in_features`: The input size. The input to the layer should be a vector of
          shape `(in_features,)`
      - `out_features`: The output size. The output from the layer will be a vector
          of shape `(out_features,)`.
      - `use_bias`: Whether to add on a bias as well.
      - `key`: A `jax.random.PRNGKey` used to provide randomness for parameter
          initialisation. (Keyword only argument.)
  
      Note that `in_features` also supports the string `"scalar"` as a special value.
      In this case the input to the layer should be of shape `()`.
  
      Likewise `out_features` can also be a string `"scalar"`, in which case the
      output from the layer will have shape `()`.
      """
      wkey, bkey = jrandom.split(key, 2)
      in_features_ = 1 if in_features == "scalar" else in_features
      out_features_ = 1 if out_features == "scalar" else out_features
      lim = 1 / math.sqrt(in_features_)
      self.weight = jrandom.uniform(
          wkey, (out_features_, in_features_), minval=-lim, maxval=lim
      )
      if use_bias:
          self.bias = jrandom.uniform(
              bkey, (out_features_,), minval=-lim, maxval=lim
          )
      else:
          self.bias = None
  
      self.in_features = in_features
      self.out_features = out_features
      self.use_bias = use_bias
  
file_path: equinox/equinox/nn/_linear.py
imports: import math
  from typing import Any, Literal, Optional, TypeVar, Union
  import jax
  import jax.numpy
  import jax.random
  from jaxtyping import Array, PRNGKeyArray
  from .._module import field, Module
label_desc: Use image node_id 1 to create a new Linear object from inherited base classes: Module with example: obj = Linear(in_features, out_features, use_bias)