๋”ฅ๋Ÿฌ๋‹/Today I learned :

python pytorch ํ…์„œ rank, un squeeze, view, ํ–‰๋ ฌ๊ณฑ

์ฃผ์˜ ๐Ÿฑ 2022. 12. 28. 01:22
728x90
๋ฐ˜์‘ํ˜•

Rank = ์ฐจ์›

rank=0 , scalar(1)

rank=1 , vector([1,2,3])

rank=2 , matrix([[1,2,3]])

rank=3, n-rank matrix([[[1,2,3]]]])

squeeze, unsqueeze, view๋Š” rank, shape์„ ๋ณ€ํ™˜์‹œํ‚ต๋‹ˆ๋‹ค.

view๋Š” ๋ฐ˜๋“œ์‹œ ์›์†Œ์˜ ๊ฐœ์ˆ˜๊ฐ€ ๊ฐ™์•„์•ผ ํ•œ๋‹ค. ๊ฐ€๋ น ์•„๋ž˜์˜ x๋ฅผ 2x4์ธ 8๊ฐœ ์›์†Œ๋ฅผ ์ง€๋‹Œ ํ…์‚ฌ๋กœ ๋ฐ”๊ฟ€์ˆ˜๋Š” ์—†๋‹ค.

 

ํ–‰๋ ฌ๊ณผ ํ–‰๋ ฌ๊ณฑ

๋ฐ˜์‘ํ˜•