What is a Tensor in TensorFlow?
Tensor
The term “tensor” was first introduced by William Rowan Hamilton in 1846. Yes, that’s the Hamilton who invented quaternions:

A Tensor is actually a multidimensional array
The purpose of Tensor is to be able to create higher-dimensional matrices and vectors.

Color Example
Color image files (RGB) are generally processed into 3-d tensors, where each element in the 2d array represents a pixel, R represents Red, G represents Green, B represents Blue

Multidimensional Arrays

Drawing a three-dimensional tensor as a cube:

Higher-dimensional tensors:

Initializing a Vector
0-Dimensional
tf.tensor(1).print();
1-Dimensional
tf.tensor([1, 2, 3, 4]).print();
// or
tf.tensor1d([1, 2, 3]).print();
2-Dimensional
tf.tensor([[1, 2], [3, 4]]).print();
// or
tf.tensor2d([[1, 2], [3, 4]]).print();
3-Dimensional
tf.tensor([[[1], [2]], [[3], [4]]]).print();
// or
tf.tensor3d([[[1], [2]], [[3], [4]]]).print();
4-Dimensional
tf.tensor([[[[1], [2]], [[3], [4]]]]).print();
// or
tf.tensor4d([[[[1], [2]], [[3], [4]]]]).print();
5-Dimensional
tf.tensor([[[[[1], [2]], [[3], [4]]]]]).print();
// or
tf.tensor5d([[[[[1], [2]], [[3], [4]]]]]).print();
6-Dimensional
tf.tensor([[[[[[1],[2]],[[3],[4]]],[[[5],[6]],[[7],[8]]]]]]).print();
// or
tf.tensor6d([[[[[[1],[2]],[[3],[4]]],[[[5],[6]],[[7],[8]]]]]]).print();