PyTorch torch.cosh Function

PyTorch torch.cosh Function


Pytorch torch 参考手册Pytorch torch Reference Manual

torch.coshis a function in PyTorch used to compute the hyperbolic cosine element-wise.

Function Definition

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

Usage Example

Example

import torch

# Hyperbolic Cosine Example
x = torch.tensor([0, 1, 2, 3], dtype=torch.float32)
result = torch.cosh(x)
print(result)  # tensor([1.0000, 1.5431, 3.7622, 10.0677])

Pytorch torch 参考手册Pytorch torch Reference Manual

Other Extensions