Project 4: Photo Batch Tensor Inspector
ML Engineer
Builds on these lessons
Current Task
Objective
Every tensor has a shape, a dtype, and a rank (number of dimensions) — the same fundamentals as a NumPy array, generalized to TensorFlow.
Task: create a 4D tensor representing a batch of photos and print its shape, dtype, and rank.
index.py
import tensorflow as tf
photo_batch = tf.zeros([32, 128, 128, 3])
print(photo_batch.shape)
print(photo_batch.dtype)
print(tf.rank(photo_batch))
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview