medium primitives

Implement Linear Layer

Implement a fully connected (linear) layer.

$$y = xW^T + b$$

Input:

  • x: input tensor of shape (batch_size, in_features)
  • weight: weight matrix of shape (out_features, in_features)
  • bias: bias vector of shape (out_features,)

Output: Tensor of shape (batch_size, out_features)

Hints

layer linear-algebra neural-network
Detecting runtime...