Table of contents
Understanding Tensor Dimensions
Basic definition and understanding of tensor
Understanding Tensor Dimensions
1 n-order tensor
Tensor tensor, in mathematics is actually a high-dimensional array,
Tensor of rank 0: scalar;
tensor of rank 1:vector,
tensor of rank 2: matrix,
Rank 3 tensors: arrays,
specifically, are:
The Physical Meaning of Tensor Dimensions
Time series: vectors of order 3
Although time series data sometimes look like tensors of order 2, when you look at the characteristics of these data as a cross-section over time, they are tensors of order 3 (including features, samples).
Rank 3 tensor
4th-order tensor: Image data
A single image can be regarded as a 3rd-order tensor (RGB, height, width), plus the number of samples, it is a 4th-order tensor.
create tensor
The difference between Tensor and numpy
Tensor, which can be 0-dimensional, one-dimensional and multi-dimensional arrays, you can think of it as Numpy in the neural network world, it is similar to Numpy, the two can share memory, and the conversion between them is very convenient. But they are not the same. The biggest difference is that Numpy will put ndarray in the CPU for accelerated calculations, while the Tensor generated by Torch will be placed in the GPU for accelerated calculations .
Original link: https://blog.csdn.net/Nicolelovesmath/article/details/88903470