Project 3: Tensor Addition Demo
ML Engineer
Builds on these lessons
Current Task
Objective
TensorFlow's core operations work element-wise on tensors, just like NumPy — tf.add is the tensor equivalent of the + operator.
Task: add two constant tensors with tf.add and print the result.
index.py
import tensorflow as tf
a = tf.constant([1, 2, 3])
b = tf.constant([4, 5, 6])
print(tf.add(a, b))
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview