torch.is_complex
-
torch.is_complex(input: Tensor) → bool -
Возвращает True, если тип данных
inputявляется комплексным типом данных, то есть одним изtorch.complex64иtorch.complex128.- Параметры:
-
input (Tensor) – входной тензор.
Пример:
>>> torch.is_complex(torch.tensor([1, 2, 3], dtype=torch.complex64)) True >>> torch.is_complex(torch.tensor([1, 2, 3], dtype=torch.complex128)) True >>> torch.is_complex(torch.tensor([1, 2, 3], dtype=torch.int32)) False >>> torch.is_complex(torch.tensor([1.0, 2.0, 3.0], dtype=torch.float16)) False
© 2026, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://docs.pytorch.org/docs/2.14/generated/torch.is_complex.html