YouTip LogoYouTip

Pytorch Torch Ldexp

# PyTorch torch.ldexp Function * * Pytorch torch Reference Manual](#) `torch.ldexp` is a function in PyTorch used to multiply a mantissa by 2 raised to the power of an exponent. It is the inverse operation of frexp. ### Function Definition torch.ldexp(input, other, out=None) * * * ## Usage Example ## Example import torch # Decompose using frexp x = torch.tensor([8.0,4.5,2.0]) mantissa, exponent = torch.frexp(x) # Reconstruct using ldexp reconstructed = torch.ldexp(mantissa, exponent) print("Reconstructed Value:", reconstructed) The output result is: Reconstructed value: tensor([8., 4.5, 2.]) * * Pytorch torch Reference Manual](#)
← Pytorch Torch LerpPytorch Torch Kthvalue β†’