Coverage for src/flag_gems/ops/tan.py: 59%

17 statements  

« prev     ^ index     » next       coverage.py v7.6.9, created at 2026-03-07 22:33 +0800

1import logging 

2 

3import triton 

4import triton.language as tl 

5 

6from flag_gems.utils import pointwise_dynamic, tl_extra_shim 

7 

8logger = logging.getLogger(__name__) 

9 

10 

11@pointwise_dynamic(promotion_methods=[(0, "INT_TO_FLOAT")]) 

12@triton.jit 

13def tan_func(x): 

14 y = tl_extra_shim.tan(x.to(tl.float32)) 

15 return y 

16 

17 

18def tan(A): 

19 logger.debug("GEMS TAN") 

20 return tan_func(A) 

21 

22 

23def tan_(A): 

24 logger.debug("GEMS TAN_") 

25 tan_func(A, out0=A) 

26 return A