AI Logic

Glossary

Output Tensor

Updated:

Diagram showing the shapes of output tensors. The input tensor at the bottom goes into the model, which then splits into three columns. The left column is a binary classification output passed through sigmoid, with one probability per sample, in the shape (batch size, 1). The middle column is a multi-class classification output passed through softmax, with one probability per class for each sample, in the shape (batch size, number of classes). The right column is an object detection output, listing the position (x, y, width, height) and class of each detected object, with the images stacked in depth. All three columns connect to the loss function in the dashed box at the top, which compares them with the ground truth during training to compute the error

Explanation

An output tensor is the multidimensional array of results that a neural network or deep learning model generates from its input data, containing the model's predicted values or outputs. This tensor represents the results of tasks such as classification, regression, and generation, and is an important element in evaluating model performance. The output tensor is obtained from the model's final layer, computed from the features passed on by the previous layers. Its number of dimensions depends on the task: binary classification yields one dimension, while multi-class classification has dimensions corresponding to the number of classes. In addition, the output layer uses an activation function such as softmax or sigmoid, which determines how the output is interpreted. The output tensor also contributes to model training through the loss function, where it is used to compute the error against the target values.

Where It Is Used

How output tensors are used depends on the task. For example, in image classification, the neurons' outputs are expressed as a probability vector indicating the confidence for each class. In object detection, the output tensor contains the positions and class labels of detected objects. In natural language processing, the model outputs a probability distribution over the next token to be generated. In reinforcement learning, the output tensor is used as the action the agent selects, and the agent learns from the rewards obtained through interaction with the environment. Finally, in generative models such as generative adversarial networks (GANs), the output is treated as a generated sample and compared with real data. The output tensor plays a crucial role in the model's final decisions and in completing the task.

FAQ

Q. What does an output tensor represent?
A.

It represents the predictions or result values that the model computed from its input, in the form of a multidimensional array.

Q. Does the shape of the output differ by task?
A.

Yes. For example, binary classification gives one dimension, multi-class classification gives one value per class, and object detection gives a multidimensional tensor that includes position information.

Q. Where is it used?
A.

It is used as the final output of every kind of deep learning task, including image classification, object detection, text generation, reinforcement learning, and generative models.