Tensor
The most fundamental data structure in machine learning frameworks, a generalization of scalars, vectors and matrices to higher dimensions. In image processing, a color image is represented as a four-dimensional tensor [batch, height, width, channels], while video adds a temporal dimension to become five-dimensional.
Timeline (last 90 days)
Understanding tensors requires grasping three basic concepts: rank (how many axes a tensor has), axis (the dimension along each direction), and shape (the size along each dimension).
In PyTorch, scalars, vectors, and matrices can all be uniformly called tensors; a vector is a one-dimensional tensor, a matrix is a two-dimensional tensor, and a tensor is a multi-dimensional data container with a shape.
In deep learning, parameters are stored as tensors in GPU memory or on disk; reading means loading and parsing, while writing involves format, precision and consistency constraints and often requires coordination with the computation graph and optimizer state.
In Lean, tensors can be represented as indexed finite-dimensional array types, with shape constraints statically checked at compile time via dependent types.
A tensor is the core data structure in machine learning, and can be understood as a general term for multi-dimensional arrays: a scalar is a 0-dimensional tensor, a vector is 1-dimensional, a matrix is 2-dimensional, and higher dimensions are N-dimensional tensors.
A forward pass is the process of a neural network computing once completely from the input layer to the output layer; an autoregressive language model needs N forward passes to generate N tokens, with latency growing linearly with output length; a classifier-style model needs only one forward pass.
张量是机器学习框架中最基础的数据结构,彩色图像通常表示为形状为[batch, height, width, channels]的四维张量,视频则再加一维时间轴。
Neural network weights are essentially multi-dimensional arrays (tensors) stored in file formats such as .safetensors, .gguf, or .bin, and the numbers themselves are static and cannot execute on their own.
Stride records the number of memory units that must be skipped to move one step in each dimension, enabling operations such as transposition and slicing to be completed by modifying strides without copying data
At the implementation level, a tensor is a contiguous block of one-dimensional memory, with two pieces of metadata—shape and stride—describing the multi-dimensional logical view
1 more timeline events
All Facts (11)
A forward pass is the process of a neural network computing once completely from the input layer to the output layer; an autoregressive language model needs N forward passes to generate N tokens, with latency growing linearly with output length; a classifier-style model needs only one forward pass.
60%UnverifiedPyTorch tensors are essentially multi-dimensional arrays, highly similar to NumPy's ndarray, but tensors can run on GPUs and have built-in automatic differentiation support.
60%UnverifiedUnderstanding tensors requires grasping three basic concepts: rank (how many axes a tensor has), axis (the dimension along each direction), and shape (the size along each dimension).
50%UnverifiedIn PyTorch, scalars, vectors, and matrices can all be uniformly called tensors; a vector is a one-dimensional tensor, a matrix is a two-dimensional tensor, and a tensor is a multi-dimensional data container with a shape.
50%UnverifiedIn deep learning, parameters are stored as tensors in GPU memory or on disk; reading means loading and parsing, while writing involves format, precision and consistency constraints and often requires coordination with the computation graph and optimizer state.
50%UnverifiedIn Lean, tensors can be represented as indexed finite-dimensional array types, with shape constraints statically checked at compile time via dependent types.
50%UnverifiedA tensor is the core data structure in machine learning, and can be understood as a general term for multi-dimensional arrays: a scalar is a 0-dimensional tensor, a vector is 1-dimensional, a matrix is 2-dimensional, and higher dimensions are N-dimensional tensors.
50%Unverified张量是机器学习框架中最基础的数据结构,彩色图像通常表示为形状为[batch, height, width, channels]的四维张量,视频则再加一维时间轴。
50%UnverifiedNeural network weights are essentially multi-dimensional arrays (tensors) stored in file formats such as .safetensors, .gguf, or .bin, and the numbers themselves are static and cannot execute on their own.
50%UnverifiedStride records the number of memory units that must be skipped to move one step in each dimension, enabling operations such as transposition and slicing to be completed by modifying strides without copying data
50%UnverifiedAt the implementation level, a tensor is a contiguous block of one-dimensional memory, with two pieces of metadata—shape and stride—describing the multi-dimensional logical view
50%