Coverage for src/flag_gems/ops/cosh.py: 89%
19 statements
« prev ^ index » next coverage.py v7.6.9, created at 2026-05-06 06:51 +0800
« prev ^ index » next coverage.py v7.6.9, created at 2026-05-06 06:51 +0800
1import logging
3import triton
4import triton.language as tl
6from flag_gems.utils import pointwise_dynamic
8logger = logging.getLogger(__name__)
11@pointwise_dynamic(promotion_methods=[(0, "INT_TO_FLOAT")])
12@triton.jit
13def cosh_func(x):
14 x = x.to(tl.float32)
15 return 0.5 * (tl.exp(x) + tl.exp(-x))
18def cosh(A):
19 logger.debug("GEMS COSH")
20 return cosh_func(A)
23def cosh_(A):
24 logger.debug("GEMS COSH_")
25 return cosh_func(A, out0=A)
28def cosh_out(A, out):
29 logger.debug("GEMS COSH_OUT")
30 return cosh_func(A, out0=out)