Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Batches | Tensors
Introduction to TensorFlow
course content

Course Content

Introduction to TensorFlow

Introduction to TensorFlow

1. Tensors
2. Basics of TensorFlow

bookBatches

Batches in Data Processing

When training a machine learning model, it's common to feed the data in small chunks rather than all at once. These chunks are called "batches". Instead of showing a model a single data item (like one image or one sentence), we might feed it a batch of, say, 32 items together. This approach can make training more stable and faster.

When thinking about tensors, this means adding an extra dimension at the beginning. So, if a single item's data was represented by a tensor of shape (height, width), a batch of these items would have the shape (batch_size, height, width). In this example, if the batch size is 32, the shape becomes (32, height, width).

Let's say we have 2048 data samples, each with a shape of (base shape). This gives us a tensor of (2048, base shape). If we break this data into batches of 32 samples, we'll end up with 64 batches, as 64 * 32 = 2048. And the new shape will be (64, 32, base shape).

When designing your own neural network or another model, you can employ different shapes for the tasks mentioned above. However, these shaping techniques are standard in Tensorflow, as they are structured both logically and hierarchically to optimize the performance of learning algorithms.

A surveillance system records videos in batches for processing. If you have batches of 10 videos, each 5 minutes long, with a frame captured every second and each frame is a `512x512` pixel colored image, what tensor shape represents this data?

A surveillance system records videos in batches for processing. If you have batches of 10 videos, each 5 minutes long, with a frame captured every second and each frame is a 512x512 pixel colored image, what tensor shape represents this data?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 5
We're sorry to hear that something went wrong. What happened?
some-alt