sonu_chauhan
sonu_chauhan

Reputation: 335

What is `Tensor` and how is it different from a vector?

I am beginner in machine learning and I am facing this question. Please provide me the simple example or content so that I can understand it in the best way.

Upvotes: 2

Views: 1328

Answers (2)

iacob
iacob

Reputation: 24301

Tensor = multi-dimensional array

In the machine learning literature, a tensor is simply a synonym for multi-dimensional array:

Tensors, also known as multidimensional arrays, are generalizations of matrices to higher orders and are useful data representation architectures.

Hence a 1.d tensor is a "vector/tuple", and a 2.d. tensor is a "matrix/2.d.array".

Implementations

In specific libraries the term may be restricted to numerical arrays:

Theano is a Python library that allows you to define, optimize, and efficiently evaluate mathematical expressions involving multi-dimensional arrays.

or those containing a broader range of data-types:

Tensor - The primary data structure in TensorFlow programs. Tensors are N-dimensional (where N could be very large) data structures, most commonly scalars, vectors, or matrices. The elements of a Tensor can hold integer, floating-point, or string values.

Etymology

Tensor has a more specific meaning in mathematics as an abstraction of a multilinear map between vector spaces, but given a fixed basis such maps can be represented as multidimensional arrays, and it is from this usage that the machine learning term gets its name.

Upvotes: 1

Feodoran
Feodoran

Reputation: 1822

If you are asking about the mathematical objects, then a tensor is something that holds values, some kind of table or array. A tensor has an order indicating on how many axis these values are arranged.

For example:

  • A tensor of order 0 is simply a single scalar number.
  • A tensor of order 1 is a vector. Each element is numbered by one index.
  • A tensor of order 2 is a matrix. Each element has two indices, e.g. row and column.

Upvotes: 1

Related Questions