W3cubDocs

/PyTorch 2.9

torch.is_floating_point

torch.is_floating_point(input: Tensor) → bool

Returns True if the data type of input is a floating point data type i.e., one of torch.float64, torch.float32, torch.float16, and torch.bfloat16.

Parameters

input (Tensor) – the input tensor.

Example:

>>> torch.is_floating_point(torch.tensor([1.0, 2.0, 3.0]))
True
>>> torch.is_floating_point(torch.tensor([1, 2, 3], dtype=torch.int32))
False
>>> torch.is_floating_point(torch.tensor([1.0, 2.0, 3.0], dtype=torch.float16))
True
>>> torch.is_floating_point(torch.tensor([1, 2, 3], dtype=torch.complex64))
False

© 2025, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://docs.pytorch.org/docs/2.9/generated/torch.is_floating_point.html