The following linear functions are commonly used:
|trace||Sum of diagonal elements (trace of matrix)|
|triu/tril||Upper / lower triangle of the matrix, offset can be specified|
|mm/bmm||Matrix multiplication, matrix multiplication of batch|
|dot/cross||Inner product / outer product|
|svd||singular value decomposition|
Note: transpose the matrix will make the storage space discontinuous, so call its. Contiguous method to make it continuous.
import torch as t b=a.t() b.is_contiguous() Output: false b=b.contiguous() b.is_contiguous() Output: true
The above detailed explanation of commonly used linear functions in Python is the whole content shared by Xiaobian. I hope I can give you a reference, and I hope you can support developeppaer more.