Complete the code to create a constant tensor with value 5.
import tensorflow as tf const_tensor = tf.[1](5)
The tf.constant function creates a constant tensor with the given value.
Complete the code to create a TensorFlow variable initialized with a list.
import tensorflow as tf var_tensor = tf.[1]([1, 2, 3])
The tf.Variable function creates a mutable tensor initialized with the given value.
Fix the error in the code to create a tensor of zeros with shape (2, 3).
import tensorflow as tf zero_tensor = tf.zeros(shape=[1])
The shape argument expects a tuple to specify dimensions, so (2, 3) is correct.
Fill both blanks to create a tensor of ones with shape (3, 4) and data type float32.
import tensorflow as tf one_tensor = tf.[1](shape=[2], dtype=tf.float32)
tf.ones creates a tensor filled with ones. The shape should be a tuple like (3, 4).
Fill all three blanks to create a variable tensor initialized with zeros of shape (2, 2) and integer type.
import tensorflow as tf var_zero_tensor = tf.[1](tf.[2](shape=[3], dtype=tf.int32))
First create a zeros tensor with tf.zeros of shape (2, 2) and then wrap it with tf.Variable to make it mutable.