PyTorch torch.expm1 Function

PyTorch torch.expm1 Function


Pytorch torch 参考手册Pytorch torch Reference Manual

torch.expm1It is a function in PyTorch used to compute exp(x) - 1 element-wise.

Function Definition

torch.expm1(input, *, out=None)

Usage Example

Example

import torch

# exp(x) - 1 example
x = torch.tensor([0, 1, 2, 3], dtype=torch.float32)
result = torch.expm1(x)
print(result)  # tensor([0.0000, 1.7183, 6.3891, 19.0855])

Pytorch torch 参考手册Pytorch torch Reference Manual

Other Extensions