nn
Linear

Linear

Creates a linear layer in your neural network. It applies a linear transformation to your data.

Usage

from tinygrad.nn import Linear
from tinygrad.tensor import Tensor
 
class TinyNet: 
    def __init__(self):
        self.l1 = Linear(784, 128)
        self.l2 = Linear(128, 10)
 
    def __call__(self, x):
      x = self.x1(x)
      x = x.leakyrelu()
      x = self.l2(x)
      return x

Arguments

in_features

The input features of data you are passing into the layer.

out_features

The number of dimensions in the output of the layer.

bias (default=True)

Indicate whether to use bias or not.

;