Skip to content

ReLU Diagram

Consolidated ASCII Diagram: From Data Point to ReLU Activation

This diagram tracks a single data point O(0.5, 1.0) through the entire process: Dense Layer 1 -> ReLU Activation 1.

Text Only
╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
║             COMPLETE FLOW DIAGRAM: LINEAR TRANSFORMATION & NON-LINEAR (RELU) ACTIVATION                      ║
╚══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝

    (STEP 1: INPUT)
    A single data point in 2D space
    ┌─────────────────────────┐
    │     Input: O(x, y)      │
    │      [0.5, 1.0]         │
    └───────────┬─────────────┘
╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
║   (STEP 2: LINEAR TRANSFORMATION - DENSE LAYER 1) - `output = v · W + b`                                     ║
║   Goal: Project the point O from 2D space into a new 3D space.                                               ║
╚══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
    ┌─────────────────────────────────────────┴──────────────────────────────────────────┐
    │                                                                                    │
    ▼ (2a: Dot Product Operation)                                                        ▼ (Layer's Parameters)
┌───────────┐         ┌─────────────────────────┐                            ┌─────────────────────────┐
│ [0.5, 1.0]│         │      Weights: W         │                            │       Biases: b         │
└─────┬─────┘         │     (2x3 Matrix)        │                            │     (1x3 Vector)        │
      │               │ [[ 0.2, 0.8,-0.5],     │                            │     [[2.0, 3.0, 0.5]]   │
      └───────────┐   │  [-0.9, 0.2, 0.4]]      │                            └─────────────┬─────────────┘
                  │   └─────────────────────────┘                                          │
                  ▼                                                                        │
┌─────────────────┴──────────────────────────────────────────────────────────────────────┐ │
│          DETAILED CALCULATION FOR EACH NEURON (Each neuron creates a new dimension)    │ │
│                                                                                        │ │
│  Neuron 0: (0.5 * 0.2) + (1.0 * -0.9) = -0.8  <───┐                                    │ │
│  Neuron 1: (0.5 * 0.8) + (1.0 *  0.2) =  0.6  <───┼──┐                                 │ │
│  Neuron 2: (0.5 *-0.5) + (1.0 *  0.4) =  0.15 <───┼──┼──┐                              │ │
└──────────────────────────────────────────────────┘  │  │  │                              │
                                                    │  │  │                              │
    (Result of v · W)                               ▼  ▼  ▼                              │
    ┌─────────────────────────┐               ┌───────┴───────┐                          │
    │  [-0.8,  0.6,   0.15]    │               │  (2b: Add Bias) │                          │
    └───────────┬─────────────┘               └───────────────┘                          │
                └───────────────────────────────────►   +   ◄────────────────────────────┘
                                          ┌─────────────────────────┐
                                          │     dense1.output       │ (Coordinates in the new space)
                                          │        (Logits)         │
                                          │ [1.2,  3.6,  0.65]      │
                                          └───────────┬─────────────┘
╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
║   (STEP 3: NON-LINEAR TRANSFORMATION - RELU ACTIVATION) - `output = max(0, x)`                             ║
║   Goal: "Bend" the space, zeroing out negative values to enable non-linear learning.                       ║
╚══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
    ┌─────────────────────────────────────────┴──────────────────────────────────────────┐
    │                                                                                    │
    ▼ (Element-wise operation)                                                           ▼
┌─────────────────────────┐                                                    ┌───────────────────────────┐
│     dense1.output       │                                                    │ activation1.output        │
│   [1.2, 3.6, 0.65]      │                                                    │      (Final Output)       │
└───────────┬─────────────┘                                                    ├───────────────────────────┤
            │                                                                  │   [1.2, 3.6, 0.65]        │
            └───────────┐                                                      └───────────────────────────┘
┌───────────────────────┴─────────────────────────┐
│           max(0, 1.2)  -->  1.2                 │
│           max(0, 3.6)  -->  3.6                 │
│           max(0, 0.65) -->  0.65                │
└─────────────────────────────────────────────────┘
* NOTE: If the input to ReLU were [-0.8, 0.6, 0.15], the output would be [0.0, 0.6, 0.15].
* This transformation to 0 is the "bending" action on the space.

==============================================================================================================
FLOW SUMMARY:
Input(2D) ──(Linear Transformation)──> Logits(3D) ──("Bending" with ReLU)──> Hidden Layer Output(3D)
==============================================================================================================