Forward Pass Through a Computational Graph
What You'll Learn
You'll learn how input data flows systematically through a computational graph's nodes and edges to produce final predictions.
The Core Idea
A computational graph is like a factory assembly line where your input data is the raw material. In the forward pass, data enters at input nodes and moves step-by-step through the graph, undergoing transformations at each node (operations like addition, multiplication, or activation functions) until it reaches the output.
Think of it this way: each node represents a computation (like multiplying by a weight or applying a sigmoid function), and each edge carries a tensor (the actual data flowing between operations). The forward pass executes these operations in topological order—respecting dependencies so that each node computes only after its inputs are ready.
How It Works
- Start with inputs: Your training example enters at the input nodes
- Traverse node by node: Follow the graph's structure, computing each operation when all its inputs are available
- Store intermediate results: Each edge holds the output tensor from one node, which becomes input to the next
- Reach the output: The final node produces your prediction (classification probability, regression value, etc.)
For example, in a simple two-layer network: input → (weight multiply) → (add bias) → (ReLU activation) → (weight multiply) → (add bias) → output. Each arrow is an edge carrying data, each operation is a node computing a result.
The forward pass is purely computational—no learning happens yet. You're simply evaluating what the current network produces given specific inputs and current parameter values.
Key Takeaway: The forward pass traces data flow through the computational graph from input to output, executing operations sequentially to transform raw data into predictions while storing intermediate activations for later use.