본문 바로가기

카테고리 없음

2주차 정리

  • torch.Tensor - class, alias(torch.FloatTensor)
    • input - torch : input의 데이터 공간을 사용
    • input - list, numpy : 새로운 torch.Tensor를 만든 후 사용
  • torch.tensor - function 
    • input을 새로운 메모리를 할당하여 복사 후 사용

  • 1차원 벡터는 행벡터, 열벡터의 형태로 둘 다 표현 가능
  • dim, axis
  • torch.triu()

torch.triu

  • einsum()
Vector inner product: "a,a->" (Assumes two vectors of same length)
Vector element-wise product: "a,a->a" (Assumes two vectors of same length)
Vector outer product: "a,b->ab" (Vectors not necessarily same length.)
Matrix transposition: "ab->ba"
Matrix diagonal: "ii->i"
Matrix trace: "ii->"
1-D Sum: "a->"
2-D Sum: "ab->"
3-D Sum: "abc->"
Matrix inner product "ab,ab->" (If you pass twice the same argument, it becomes a matrix L2 norm)
Left-multiplication Matrix-Vector: "ab,b->a"
Right-multiplication Vector-Matrix: "a,ab->b"
Matrix Multiply: "ab,bc->ac"
Batch Matrix Multiply: "Yab,Ybc->Yac"
Quadratic form / Mahalanobis Distance: "a,ab,b->"
#ref https://ita9naiwa.github.io/numeric%20calculation/2018/11/10/Einsum.html

permute

  • permute(dim=) 차원 변경