← Back to CoursesTensorFlow & AI Programming: Intermediate

Neuroanatomy Explorer

Drag to rotate · scroll to zoom · click regions to explore

View
Loading 3D model…

Click a region
to explore it

Memory Deck

Flip each card and rate whether you knew it. Your score is saved.

Term
Definition

Deck complete — score saved.

Match the Pairs

Match each term to its definition. Finish the board to earn your score.

All matched — score saved.

Concept Constellation

Every key idea in this course, mapped as an explorable 3D constellation. Drag to rotate, scroll to zoom, click a node.

Click a node to read its definition.

Tensors, Shapes, Dtypes, and Broadcasting

Manual: General · Subject: TensorFlow & AI Programming

Learn how TensorFlow stores data, how shapes affect computation, and how broadcasting simplifies math.

Representing Data as Tensors

Tensor Structure

A tensor combines shape, data type, and values. For example, a vector of length 33 has shape (3,)(3,), while a batch of 3232 RGB images of size 224×224224 \times 224 has shape (32,224,224,3)(32, 224, 224, 3) if channels are last.

Tensor Rank Examples

RankExampleShape
0Scalar()
1Vector(n,)
2Matrix(m, n)
3Color image batch(batch, height, width, channels)
💡

Broadcasting

Broadcasting lets TensorFlow align tensors with different shapes when one dimension is 11 or missing, reducing the need for manual reshaping.

Why Shape Discipline Matters

Most tensor errors come from mismatched shapes or incompatible ranks. Knowing when to use reshape, expand_dims, squeeze, transpose, and concatenate is essential for stable model code.

Useful Tensor Operations

reshape
Change shape without changing data order when possible.
expand_dims
Insert a size-11 dimension.
squeeze
Remove size-11 dimensions.
transpose
Reorder axes.

Which shape most likely represents a batch of grayscale images?

What does broadcasting help TensorFlow do?

Why is dtype important?