torch.frexp
-
torch.frexp(input, *, out=None) -> (Tensor mantissa, Tensor exponent) -
Разлагает
inputна тензоры мантиссы и показателя степени так, что .Мантисса принимает значения из открытого интервала (-1, 1).
Поддерживает входные данные с плавающей точкой.
- Параметры:
-
input (Tensor) – входной тензор
- Именованные аргументы:
-
out (tuple, необязательно) – выходные тензоры
Пример:
>>> x = torch.arange(9.) >>> mantissa, exponent = torch.frexp(x) >>> mantissa tensor([0.0000, 0.5000, 0.5000, 0.7500, 0.5000, 0.6250, 0.7500, 0.8750, 0.5000]) >>> exponent tensor([0, 1, 2, 2, 3, 3, 3, 3, 4], dtype=torch.int32) >>> torch.ldexp(mantissa, exponent) tensor([0., 1., 2., 3., 4., 5., 6., 7., 8.])
© 2026, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://docs.pytorch.org/docs/2.14/generated/torch.frexp.html