파이토치 #3
2024. 1. 23.
is_tensor(input)
텐서 여부를 확인하는 함수

 

0이 아니냐~~? ->true
is_nonzero(input)

 
 
 
 
 
 



목차
tensor
from_numpy
zeos
ones

 

 

 

 

 

 

 

목차

Indexing

Slicing

joining

Mutating Ops

 

indexing

1. randn(3,4)
2. index_select(x, 0, indices): 열(0과 2를 가져옴)
3. index_select(x,1, indices): 행 





    tensor = torch.ones(4,4)
    |  1   1   1   1   |
    |  1   1   1   1   |
    |  1   1   1   1   |
    |  1   1   1   1   |

  tensor[:, 1(행)] = 0

 

 

 

 

joining

 

 

Mutating- permute(위치를 교환)

 

Mutating- reshape

Mutating - Transpose(행과 열 교환)

 

Mutating - Squeeze

그 외

random Sampling

rand

* 랜덤은 어디에 쓰는 걸까?

 

 

Math operations

Arithmetic operation
Pointwise Ops

 

abs

add

cos

pow

Reduction Ops(차원을 감소시킴)
    argmax

인덱스를 가져오는 함수: tensor(0)이 가장 큰 인덱스이다.

 

    argmin


    sum

tensor의 값을 더해서, 텐서의 크기를 줄인다.


    unique

이건 용도를 모르겠다.

 

Comparison Ops
    eq

텐서(행,열), 텐서(행,열) 각 값을 비교해서 값이 같은지 확인. 

 


    equal

텐서 자체에 대한 비교

 


    isinf

infinity일 떄 true


    isnan

nan은 값이 너무 작아서 인식을 못 할 때 발생, ex) 0.00001 소수점 5가지까지 읽을 수 있는데 6까지 넘어갈 때

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

'2023 > pytorch' 카테고리의 다른 글

[1] 파이토치_기본_240128  (1) 2024.01.28
파이토치 #2  (0) 2024.01.17
파이토치 #1  (0) 2024.01.16