2024-02-24 tmp from 텐서가 무엇인가요?(5m, short) - YouTube - 허민석
https://www.youtube.com/watch?v=m0qwxNA7IzI
{
1:15
문장,sentence이 다음 세 개가 있을 때
hi John
hi James
hi Brian
unique word dictionary를 만들고 / index를 부여하고 /
단어,word들을 0,1-vector? 암튼
벡터,vector(이건 sparse_vector)로 만든다
unique word | 인덱스,index | one-hot_encoding_vector (원핫,one-hot one-hot_encoding rel. one-hot_encoder) |
hi | 0 | [1,0,0,0] |
John | 1 | [0,1,0,0] |
James | 2 | [0,0,1,0] |
Brian | 3 | [0,0,0,1] |
그렇다면 각 sentence에 대한
벡터표현,vector_representation은
sentence | vector representation |
hi John | [[1,0,0,0],[0,1,0,0]] |
hi James | [[1,0,0,0],[0,0,1,0]] |
hi Brian | [[1,0,0,0],[0,0,0,1]] |
이것을 입력할 때는 이런 mini-batch input형식으로 한다
| hi | John | hi | James | hi | Brian | |
[ | [[1,0,0,0], | [0,1,0,0]], | [[1,0,0,0], | [0,0,1,0]], | [[1,0,0,0], | [0,0,0,1]] | ] |
즉 하나의 배열에 모든 문장이 들어간 형태로.
그리고
- 각 단어,word는 4개의 숫자로 표현 (i.e. 길이 4의 one-hot vector)
- 각 문장은 2개의 단어로 표현 (그럼 문장의 단어 길이가 제각각인 경우가 대부분일텐데, 그땐 그 중 max? - 그런 듯)
- 총 3개의 문장이 있음
그래서 이 tensor의 shape는 (3,2,4)이다. // 3d tensor
(rank-3 tensor)
이 수는 각각
3: sample dimension (몇 개의 sample을 갖고 있는가)
2: max length of sentence (문장의 단어의 수의 최대값)
4: word vector dimension (각 word들은 몇 개의 수로 표현되는가)
3:50부터는 image_processing 에서의 tensor 얘기.
ex.
grayscale image: (3,5,5) 3d tensor로 표현.
color image: (3,5,5,3) 4d tensor로 표현.
컬러 비디오의 경우는 물론 5d tensor.
}