Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.cosh function

PyTorch torch.cosh function

PyTorch torch.cosh function


PyTorch torch reference manual PyTorch torch reference manual

torch.cosh is a PyTorch function for computing the hyperbolic cosine element-wise.

Function definition

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


Usage examples

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 reference manual PyTorch torch reference manual