Products
Features
YouTube Video Summarizer
Summarize YouTube videos
Web & PDF Highlighter
Highlight web pages & PDFs
Chat with PDF
Ask any PDF questions with AI
Ask AI Clone
Chat with your highlights & memories
Audio Transcriber
Transcribe audio files to text
Glasp Reader
Read and highlight articles
Kindle Highlight Export
Export your Kindle highlights
Idea Hatch
Hatch ideas from your highlights
Integrations
Obsidian Plugin
Notion Integration
Pocket Integration
Instapaper Integration
Medium Integration
Readwise Integration
Snipd Integration
Hypothesis Integration
Apps & Extensions
Chrome Extension
Safari Extension
Edge Add-ons
Firefox Add-ons
iOS App
Android App
Discover
Discover
Ideas
Discover new ideas and insights
Articles
Curated articles and insights
Books
Book recommendations by great minds
Posts
Essays and notes from readers
Quotes
Inspiring quotes collection
Videos
Curated videos and summaries
Explore Glasp
Glasp Newsletter
Weekly insights and updates
Glasp Talk
Interview series with great minds
Glasp Blog
Latest news and articles
Glasp Use Cases
Learn how others use Glasp
Build & Support
Glasp API
Access Glasp's API for developers
MCP Connector
Connect Glasp to Claude & ChatGPT
Community
Glasp Reddit Community
Students
Student discount and benefits
FAQs
Frequently Asked Questions
AboutPricing
DashboardLog inSign up

TensorFlow Tutorial 16 - Custom Training Loops

16.9K views
•
September 2, 2020
by
Aladdin Persson
YouTube video player
TensorFlow Tutorial 16 - Custom Training Loops

TL;DR

Learn how to implement training loops from scratch in TensorFlow, removing reliance on the model.fit function.

Transcript

what is going on guys hope you're doing freaking awesome in this video i'm gonna show you how to do training loops from scratch so this means that we're no longer using model.fit but rather we're doing everything by ourselves from scratch uh if you're familiar with coding in pytorch then this is going to be more how you're used to training networks... Read More

Key Insights

  • 🎮 The video demonstrates how to implement training loops from scratch in TensorFlow, removing reliance on the model.fit function.
  • 👤 By understanding the structure of a training loop, users can gain more control and flexibility in their machine learning models.
  • 😥 The code provided showcases a basic model trained on the MNIST dataset, serving as a starting point for more complex model architectures.
  • 👻 Training loops can be customized to suit different tasks and datasets, allowing for better experimentation and optimization.
  • 🛟 The importance of understanding the basics of a training loop is emphasized, as it serves as a foundation for tackling more advanced machine learning techniques.
  • 👨‍💻 The video highlights the similarities between TensorFlow and PyTorch coding styles, making it easier for users familiar with PyTorch to transition to TensorFlow.
  • 😘 The concept of recording operations with tf.GradientTape and applying gradients with the optimizer is essential for training models effectively.

Install to Summarize YouTube Videos and Get Transcripts

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: What is the purpose of this video?

The purpose is to show how to create training loops without relying on the model.fit function in TensorFlow.

Q: How does the training loop iterate through epochs and batches?

The loop iterates through a specified number of epochs and then iterates through all batches in the training dataset using the enumerate function.

Q: How does TensorFlow record operations in the forward propagation phase?

TensorFlow uses tf.GradientTape to record the operations in the forward propagation phase, allowing for backpropagation during training.

Q: How does the model calculate gradients and update the trainable weights?

The gradients of the loss with respect to the trainable weights are computed using tape.gradient, and then the optimizer applies these gradients to update the weights using optimizer.apply_gradients.

Q: How is the training accuracy calculated and updated?

The accuracy metric is updated during each batch iteration using accuracy_metric.update_state. At the end of each epoch, the training accuracy is calculated using accuracy_metric.result.

Q: What is the purpose of the test loop?

The test loop is used to evaluate the model's performance on the test dataset. It calculates the accuracy over the test set and updates the accuracy_metric in a similar way as the training loop.

Q: Can the training loop be encapsulated in a function?

Yes, the training loop can be defined as a function called "train_one_epoch" and called within a for loop for the desired number of epochs.

Q: How does understanding the basic layout of a training loop benefit more complex tasks?

Understanding the basic structure of a training loop helps in comprehending more complex tasks like GANs since they follow the same fundamental principles.

Summary & Key Takeaways

  • This video demonstrates how to create training loops from scratch in TensorFlow, using PyTorch-style coding.

  • The content provides a general structure for training loops and showcases a simple model trained on the MNIST dataset.

  • It emphasizes the importance of understanding this fundamental layout for more complex tasks like GANs.


Read in Other Languages (beta)

English

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Explore More Summaries from Aladdin Persson 📚

CycleGAN Paper Walkthrough thumbnail
CycleGAN Paper Walkthrough
Aladdin Persson

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Apps & Extensions

  • Chrome Extension
  • Safari Extension
  • Edge Add-ons
  • Firefox Add-ons
  • iOS App
  • Android App

Key Features

  • YouTube Video Summarizer
  • Web & PDF Summarizer
  • Web & PDF Highlighter
  • Chat with PDF
  • Ask AI Clone
  • Audio Transcriber
  • Glasp Reader
  • Kindle Highlight Export
  • Idea Hatch

Integrations

  • Obsidian Plugin
  • Notion Integration
  • Pocket Integration
  • Instapaper Integration
  • Medium Integration
  • Readwise Integration
  • Snipd Integration
  • Hypothesis Integration

More Features

  • APIs
  • MCP Connector
  • Blog & Post
  • Embed Links
  • Image Highlight
  • Personality Test
  • Quote Shots

Company

  • About us
  • Blog
  • Community
  • FAQs
  • Job Board
  • Newsletter
  • Pricing
Terms

•

Privacy

•

Guidelines

© 2026 Glasp Inc. All rights reserved.