Coverage for src/flag_gems/ops/atan2.py: 94%

16 statements  

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

1import logging 

2 

3import triton 

4import triton.language as tl 

5 

6from flag_gems.utils import pointwise_dynamic, tl_extra_shim 

7 

8_atan2 = tl_extra_shim.atan2 

9 

10logger = logging.getLogger(__name__) 

11 

12 

13@pointwise_dynamic(promotion_methods=[(0, 1, "DEFAULT")]) 

14@triton.jit 

15def atan2_kernel(x, y): 

16 return _atan2(x.to(tl.float32), y.to(tl.float32)) 

17 

18 

19def atan2(input, other): 

20 logger.debug("GEMS ATAN2") 

21 return atan2_kernel(input, other) 

22 

23 

24def atan2_out(input, other, out): 

25 logger.debug("GEMS ATAN2_OUT") 

26 return atan2_kernel(input, other, out0=out)