There's more...
Very often, we will need constant tensor objects with a large size; in this case, to optimize memory, it is better to declare them as variables with a trainable flag set to False:
t_large = tf.Variable(large_array, trainable = False)
TensorFlow was designed to work impeccably with Numpy, hence all the TensorFlow data types are based on those of Numpy. Using tf.convert_to_tensor(), we can convert the given value to tensor type and use it with TensorFlow functions and operators. This function accepts Numpy arrays, Python Lists, and Python scalars and allows interoperability with tensor Objects.
The following table lists some of the common TensorFlow supported data types (taken from TensorFlow.org):
Note that unlike Python/Numpy sequences, TensorFlow sequences are not iterable. Try the following code:
for i in tf.range(10)
You will get an error:
#TypeError("'Tensor' object is not iterable.")