찬호의 Too Much Intelligence

torch.is_complex() 본문

PyTorch Reference API/torch

torch.is_complex()

frogbam07 2025. 10. 21. 21:11

torch.is_complex(input: Tensor) -> bool

Return True if the data type of input is a complex data type i.e., one of torch.complex64, and torch.complex128.

 

import torch

t = torch.tensor([1,2,3], dtype=torch.complex64) # True
print(torch.is_complex(t))
t = torch.tensor([1,2,3], dtype=torch.int32)     # False 
print(torch.is_complex(t))

 

❓torch.complex64, torch.complex128?

PyTorch에서 복소수(complex number)를 다루기 위한 dtype이 torch.complex64, torch.complex128이다.

'PyTorch Reference API > torch' 카테고리의 다른 글

torch.is_storage()  (0) 2025.10.21
torch.is_tensor()  (0) 2025.10.21