Coverage for src/flag_gems/ops/erf.py: 88%

16 statements  

« prev     ^ index     » next       coverage.py v7.6.9, created at 2026-03-21 14:31 +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, "DEFAULT")]) 

12@triton.jit 

13def erf_func(x): 

14 output = tl.math.erf(x.to(tl.float32)) 

15 return output 

16 

17 

18def erf(x): 

19 logger.debug("GEMS ERF") 

20 return erf_func(x) 

21 

22 

23def erf_(x): 

24 logger.debug("GEMS ERF_") 

25 return erf_func(x, out0=x)