mlx.nn.Linear#

class mlx.nn.Linear(input_dims: int, output_dims: int, bias: bool = True)#

Applies an affine transformation to the input.

Concretely:

\[y = W^\top x + b\]

where \(W\) has shape [output_dims, input_dims].

Parameters:
  • input_dims (int) – The dimensionality of the input features

  • output_dims (int) – The dimensionality of the output features

  • bias (bool, optional) – If set to False then the layer will not use a bias. Default True.