Coverage for src/flag_gems/runtime/backend/_cambricon/ops/tan.py: 0%

18 statements  

« prev     ^ index     » next       coverage.py v7.6.9, created at 2026-03-15 02:11 +0800

1import logging 

2 

3import triton 

4import triton.language as tl 

5 

6from flag_gems.utils import tl_extra_shim 

7 

8from ..utils.pointwise_dynamic import pointwise_dynamic 

9 

10logger = logging.getLogger(__name__) 

11 

12 

13@pointwise_dynamic(is_tensor=[True, False], promotion_methods=[(0, "INT_TO_FLOAT")]) 

14@triton.jit 

15def tan_func(x, inplace): 

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

17 return y 

18 

19 

20def tan(A): 

21 logger.debug("GEMS_CAMBRICON TAN") 

22 return tan_func(A, False) 

23 

24 

25def tan_(A): 

26 logger.debug("GEMS_CAMBRICON TAN_") 

27 tan_func(A, True, out0=A) 

28 return A