What is the key difference between tf.Variable and tf.constant?
-
A
They are identical names for the same object type
-
B
A constant is stored on the GPU; a Variable cannot be
-
C
A Variable's value can be updated; a constant's cannot
Correct answer
-
D
A Variable holds only scalars; a constant holds arrays
Correct answer
C. A Variable's value can be updated; a constant's cannot
16 views
Explanation
Model weights are tf.Variable objects so optimisers can assign new values during training. Tensors created with tf.constant are immutable.
Reference
Asked in: Data Science Interviews, AI Engineer Interviews
Doubts & discussion
Not sure why the answer is C? Ask here and get an explanation.
Ask a doubt about this MCQ