Tensors — Representation of Data In Neural Networks
Published in
4 min readDec 14, 2019
What you will learn?
- Tensors
- Key Attributes Of Tensor
- Real-World Examples of Tensors
What is Tensor?
It is a container of Data, which helps to store different dimensions of Data in Neural Networks
Google’s Machine Learning Library TensorFlow was named after them.
Scalar or Rank 0 or 0-D Tensors
- A tensor that contains only one number is called a scalar.
- A Scalar tensor has 0 axes (ndim == 0)
- The number of axes is called a rank of the tensor.
Code :
ignition = tf.Variable(451, tf.int16)
floating = tf.Variable(3.14159265359, tf.float64)
its_complicated = tf.Variable(12.3–4.85j, tf.complex64)
Vector or Rank 1 or 1-D Tensors
- An array of numbers is called a vector, or 1-D Tensor.
Code:
mystr = tf.Variable([“Hello”], tf.string)
cool_numbers = tf.Variable([3.14159, 2.71828], tf.float32)