Coverage for src/flag_gems/ops/log1p.py: 80%

15 statements  

« prev     ^ index     » next       coverage.py v7.6.9, created at 2026-06-10 07:09 +0800

1import logging 

2 

3import triton 

4import triton.language as tl 

5 

6from flag_gems.utils import pointwise_dynamic 

7 

8logger = logging.getLogger(__name__) 

9 

10 

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

12@triton.jit 

13def log1p_func(x): 

14 return tl.log(1.0 + x.to(tl.float32)).to(x.dtype) 

15 

16 

17def log1p(A): 

18 logger.debug("GEMS LOG1P") 

19 return log1p_func(A) 

20 

21 

22def log1p_out(A, out): 

23 logger.debug("GEMS LOG1P_OUT") 

24 return log1p_func(A, out0=out)