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

14 statements  

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

1import logging 

2 

3import triton 

4 

5from ..utils.pointwise_dynamic import pointwise_dynamic 

6 

7logger = logging.getLogger("flag_gems").getChild(__name__.lstrip(".")) 

8 

9 

10@pointwise_dynamic(is_tensor=[True, False], promotion_methods=[(0, "DEFAULT")]) 

11@triton.jit 

12def neg_func(x, inplace): 

13 return -x 

14 

15 

16def neg(A): 

17 logger.debug("GEMS_CAMBRICON NEG") 

18 return neg_func(A, False) 

19 

20 

21def neg_(A): 

22 logger.debug("GEMS_CAMBRICON NEG_") 

23 return neg_func(A, True, out0=A)