Notes

Input Layer

An input layer is the network’s receiving dock: it defines the form in which data enters a model. Before any learned computation begins, the input layer establishes how many values arrive per example and how those values are arranged.

What it represents
In a simple fully connected network, an example might arrive as a vector such as [0.2, -1.1, 0.7, ...]. If there are 100 values, the model’s input is shaped as 100 features per example. A batch of 32 examples therefore has shape (32, 100), where 32 is the batch size. The first learned layer—such as a PyTorch nn.Linear(100, 256) layer—expects exactly those 100 incoming values and owns weights connecting them to its 256 units.

It is a contract, not usually a computation
Unlike hidden layers, an input layer usually has no trainable weights and does not transform the data. Its main job is to declare the model’s expected input structure. That structure can be more than a flat vector:

  • A sequence can be represented by positions and feature channels.
  • A set of categorical IDs can enter an embedding layer as integer indices.
  • A structured tensor can preserve several axes for later layers to interpret.

The key point is that the input layer preserves a clear agreement between the data pipeline and the first learned operation.

Why it matters during training
A wrong input shape causes an immediate dimension-mismatch error, but subtler mistakes train without crashing. Features on wildly different scales can make gradients unstable and force a tiny learning rate; inconsistent feature ordering means the model learns from scrambled meaning; and applying training-only preprocessing differently at inference produces unreliable predictions. Input normalization—such as centering each numeric feature and scaling it to a comparable range—makes the first layer’s activations easier to optimize. Gradients flow backward through the input values, but the input layer itself is not updated: it is the doorway through which data enters and learning signals trace their way back.

The input layer is the network entry point that receives each example as a vector, tensor, or structured set of feature values and passes it to subsequent layers. It typically performs no learned transformation itself; its shape defines the expected input dimensions. A correctly specified input layer ensures that data is represented consistently so downstream weights, activations, and training computations operate on compatible values.

Think of a neural network as a factory that turns raw information into an answer. The input layer is the factory’s receiving door: it is where the information first enters.

For a photo-recognising system, the input might be the picture’s tiny color values. For a system predicting house prices, it might receive details such as size, location, and number of bedrooms. For language, it receives a computer-readable form of words.

The input layer does not decide what anything means. Its job is simply to present the incoming facts clearly to the rest of the network, which then looks for useful patterns and produces a result.