← 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.

TensorFlow Coding Basics: Tensors, Variables, and Operations

Manual: General · Subject: TensorFlow & AI Programming

Write TensorFlow code to create tensors, manage variables, and perform numerical transformations.

From Raw Values to Computation

Tensor Creation

TensorFlow provides utilities such as constants, zeros, ones, ranges, random tensors, and conversion from NumPy arrays. In practice, you create tensors from your dataset and then apply mathematical operations such as addition, multiplication, matrix multiplication, and reductions.

Variables and Mutation

A tensor is immutable, while a variable is designed for state that changes during training, such as model weights. Variables allow optimization algorithms to update parameters across training steps.

Basic TensorFlow Coding Pattern

  1. 1

    1. Import TensorFlow and check the version.

  2. 2

    2. Create tensors from constants or arrays.

  3. 3

    3. Inspect shape and dtype.

  4. 4

    4. Apply arithmetic and linear algebra operations.

  5. 5

    5. Use variables when values must be updated during training.

⚠️

Common Pitfall

Do not confuse Python lists with tensors. Lists are general-purpose containers; tensors carry numeric type, shape metadata, and optimized execution behavior.

Operational Differences

Elementwise ops
Act independently across each tensor element.
Matrix multiplication
Combines rows and columns using linear algebra rules.
Reduction
Collapses dimensions with functions like sum or mean.
Casting
Converts values to a different dtype.

Which TensorFlow object is meant for trainable state that changes over time?

Why are variables used in model training?

What does a reduction operation do?