Where Are the PyTorch and TensorFlow Notebooks Located in AI-For-Beginners?

The PyTorch and TensorFlow notebooks in Microsoft's AI-For-Beginners repository are located under the lessons/ directory, organized by topic with framework-specific files in the same folders.

Microsoft's AI-For-Beginners curriculum provides a comprehensive introduction to artificial intelligence through hands-on Jupyter notebooks. Each major topic typically includes parallel implementations in both PyTorch and TensorFlow/Keras, allowing learners to compare APIs and choose their preferred framework.

Neural Networks Frameworks: The Primary Entry Point

The most fundamental PyTorch and TensorFlow notebooks live in the neural networks section. These files introduce core deep-learning concepts through each framework's native API.

PyTorch Introduction Notebook

Path: lessons/3-NeuralNetworks/05-Frameworks/IntroPyTorch.ipynb

This notebook covers tensor operations, automatic differentiation (autograd), and building simple neural networks with torch.nn modules. It serves as the canonical starting point for PyTorch learners in the curriculum.

TensorFlow/Keras Introduction Notebook

Path: lessons/3-NeuralNetworks/05-Frameworks/IntroKerasTF.ipynb

The TensorFlow counterpart demonstrates Keras's high-level API for model building, compilation, and training. Both notebooks cover identical concepts—feedforward networks, backpropagation, and optimization—implemented with their respective frameworks.

Natural Language Processing: GPT Implementations

The language modeling section contains framework-specific implementations of GPT-style architectures.

  • PyTorch: lessons/5-NLP/20-LangModels/GPT-PyTorch.ipynb
  • TensorFlow: lessons/5-NLP/20-LangModels/GPT-TF.ipynb (located in the same folder)

These notebooks implement transformer-based language models, demonstrating how the same architecture translates across frameworks while highlighting API differences in attention mechanisms and training loops.

Deep Reinforcement Learning: CartPole Examples

The reinforcement learning lessons provide complete, runnable environments with both framework implementations.

Framework Path
PyTorch lessons/6-Other/22-DeepRL/CartPole-RL-PyTorch.ipynb
TensorFlow lessons/6-Other/22-DeepRL/CartPole-RL-TF.ipynb

Both notebooks solve the classic CartPole control problem using deep Q-learning, with identical environment wrappers and comparable network architectures.

Computer Vision: Convolutional Networks

The computer vision section follows the same pattern with framework-specific convnet implementations.

  • PyTorch: lessons/4-ComputerVision/07-ConvNets/pytorchcv.ipynb
  • TensorFlow: lessons/4-ComputerVision/07-ConvNets/tensorflowcv.ipynb

These notebooks demonstrate image classification with convolutional layers, batch normalization, and transfer learning techniques.

Quick Code Comparison: PyTorch vs. TensorFlow

Both APIs implement identical linear transformations with different syntax:


# PyTorch: module-level API with explicit forward calls

import torch
x = torch.randn(2, 3)
linear = torch.nn.Linear(3, 1)
y = linear(x)
print(y)

# TensorFlow/Keras: layers API with built-in call method

import tensorflow as tf
x = tf.random.normal((2, 3))
dense = tf.keras.layers.Dense(1)
y = dense(x)
print(y)

Running these snippets in their respective notebooks demonstrates the core philosophical difference: PyTorch's explicit computation graph construction versus TensorFlow's eager execution with Keras abstractions.

Translated Versions and File Organization

All notebooks exist in translated form under translations/<language>/lessons/... with identical directory structures. The canonical English versions listed above contain the most current content and are referenced directly in the curriculum's README.

Summary

  • Primary location: All PyTorch and TensorFlow notebooks reside under lessons/ organized by topic (neural networks, NLP, computer vision, reinforcement learning)
  • Naming convention: Framework-specific suffixes (PyTorch, TF, KerasTF) or prefixes (pytorchcv, tensorflowcv) identify each implementation
  • Parallel structure: Most topics provide both framework implementations in the same directory for direct comparison
  • Entry points: Start with lessons/3-NeuralNetworks/05-Frameworks/ for fundamental API introductions

Frequently Asked Questions

How do I know which notebook to use if I only know one framework?

Each lesson directory containing IntroPyTorch.ipynb will also contain IntroKerasTF.ipynb or similarly named TensorFlow variants. Check the directory listing for your topic—the frameworks are consistently paired.

Are the PyTorch and TensorFlow notebooks identical in content?

The algorithms and concepts match, but implementations follow idiomatic patterns for each framework. PyTorch notebooks emphasize manual gradient computation and explicit training loops; TensorFlow/Keras notebooks leverage model.fit() and higher-level abstractions where appropriate.

Can I run these notebooks without local installation?

Yes. Every notebook includes an "Open in GitHub Codespaces" or "Open in Binder" badge. Click any direct GitHub link from the paths above, then select the cloud execution option to run immediately without setup.

Do the notebooks require GPU acceleration?

The introductory notebooks (IntroPyTorch.ipynb, IntroKerasTF.ipynb) run on CPU. Advanced topics like GPT-PyTorch.ipynb benefit from GPU acceleration for reasonable training times, but include pre-trained weights or reduced dataset options for CPU execution.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →