Recall & Review
beginner
What is a constant tensor in TensorFlow?
A constant tensor is a fixed value tensor that cannot be changed after creation. It holds data that stays the same during the program run.
Click to reveal answer
beginner
How does a variable tensor differ from a constant tensor?
A variable tensor can change its values during program execution, useful for model parameters that update during training.
Click to reveal answer
beginner
What does tf.zeros(shape) do?
It creates a tensor filled with zeros of the specified shape. For example, tf.zeros([2,3]) creates a 2x3 tensor filled with zeros.
Click to reveal answer
beginner
What is the use of tf.ones(shape)?
It creates a tensor filled with ones of the given shape. Useful for initializing tensors where all values start as one.
Click to reveal answer
intermediate
How do you create a variable tensor initialized with ones in TensorFlow?
Use tf.Variable(tf.ones(shape)) to create a variable tensor filled with ones that can be updated later.
Click to reveal answer
Which TensorFlow function creates a tensor that cannot be changed after creation?
✗ Incorrect
tf.constant() creates a tensor with fixed values that cannot be modified.
What does tf.zeros([3,2]) produce?
✗ Incorrect
tf.zeros([3,2]) creates a tensor with 3 rows and 2 columns filled with zeros.
Which tensor type allows changing its values during training?
✗ Incorrect
Variable tensors can be updated, which is essential for training models.
How do you create a tensor filled with ones in TensorFlow?
✗ Incorrect
tf.ones(shape) creates a tensor filled with ones of the specified shape.
Which code creates a variable tensor initialized with zeros?
✗ Incorrect
tf.Variable(tf.zeros(shape)) creates a variable tensor initialized with zeros.
Explain the difference between tf.constant and tf.Variable tensors and when to use each.
Think about whether the tensor values need to change during training.
You got /4 concepts.
Describe how to create tensors filled with zeros and ones and why these might be useful.
Consider initialization in neural networks.
You got /4 concepts.