mlx.nn.Linear#
- class Linear(input_dims: int, output_dims: int, bias: bool = True)#
Applies an affine transformation to the input.
Concretely:
\[y = x W^\top + b\]where: where \(W\) has shape
[output_dims, input_dims]
and \(b\) has shape[output_dims]
.The values are initialized from the uniform distribution \(\mathcal{U}(-{k}, {k})\), where \(k = \frac{1}{\sqrt{D_i}}\) and \(D_i\) is equal to
input_dims
.- Parameters:
Methods
to_quantized
([group_size, bits])Return a
QuantizedLinear
layer that approximates this layer.