Dokumentation (english)

AI Model Architecture

How AI models are built with layers

An AI model architecture describes how an AI model is built. It defines which layers the model has and how data flows through them.

Each layer:

  1. applies a mathematical rule
  2. changes the data a little You can think of layers like filters that data passes through.

Example: Neural Network Architecture

Here is an example of how developers define layers in code. This example is created with pytorch. A very common library used to define networks.

import torch
import torch.nn as nn

class NeuralNetwork(nn.Module):
    def __init__(self):
        super().__init__()

        # Flattens a 28x28 image into a vector of length 784
        self.flatten = nn.Flatten()

        # Stack of linear layers with ReLU activation
        self.linear_relu_stack = nn.Sequential(
            nn.Linear(28 * 28, 512),
            nn.ReLU(),
            nn.Linear(512, 512),
            nn.ReLU(),
            nn.Linear(512, 10)  # 10 output classes
        )

    def forward(self, x):
        x = self.flatten(x)
        logits = self.linear_relu_stack(x)
        return logits

This model has multiple layers stacked together:

  1. Flatten layer: Converts the image into a single list of numbers
  2. Linear layer: Applies mathematical transformations
  3. ReLU layer: Applies a simple rule (keep positive numbers, turn negative to zero)
  4. Final layer: Outputs 10 numbers (one for each class)

Learn how this works with classification.


Command Palette

Search for a command to run...

Schnellzugriffe
STRG + KSuche
STRG + DNachtmodus / Tagmodus
STRG + LSprache ändern

Software-Details
Kompiliert vor etwa 9 Stunden
Release: v4.0.0-production
Buildnummer: master@d237a7f
Historie: 10 Items