|
1 | 1 | import logging |
2 | 2 |
|
3 | | -import torch |
4 | 3 | import triton |
5 | 4 | import triton.language as tl |
6 | 5 |
|
@@ -32,20 +31,21 @@ def fmod_func_tensor_scalar(x, y): |
32 | 31 | return result.to(dtype) |
33 | 32 |
|
34 | 33 |
|
35 | | -def fmod(A, B): |
36 | | - logger.debug("GEMS FMOD") |
37 | | - if isinstance(A, torch.Tensor) and isinstance(B, torch.Tensor): |
38 | | - return fmod_func(A, B) |
39 | | - elif isinstance(A, torch.Tensor): |
40 | | - return fmod_func_tensor_scalar(A, B) |
41 | | - else: |
42 | | - # Both scalar - fallback to PyTorch |
43 | | - return torch.fmod(torch.tensor(A), B) |
| 34 | +def fmod_tensor(A, B): |
| 35 | + logger.debug("GEMS FMOD TENSOR") |
| 36 | + return fmod_func(A, B) |
44 | 37 |
|
45 | 38 |
|
46 | | -def fmod_(A, B): |
47 | | - logger.debug("GEMS FMOD_") |
48 | | - if isinstance(B, torch.Tensor): |
49 | | - return fmod_func(A, B, out0=A) |
50 | | - else: |
51 | | - return fmod_func_tensor_scalar(A, B, out0=A) |
| 39 | +def fmod_scalar(A, B): |
| 40 | + logger.debug("GEMS FMOD SCALAR") |
| 41 | + return fmod_func_tensor_scalar(A, B) |
| 42 | + |
| 43 | + |
| 44 | +def fmod_tensor_(A, B): |
| 45 | + logger.debug("GEMS FMOD_ TENSOR") |
| 46 | + return fmod_func(A, B, out0=A) |
| 47 | + |
| 48 | + |
| 49 | +def fmod_scalar_(A, B): |
| 50 | + logger.debug("GEMS FMOD_ SCALAR") |
| 51 | + return fmod_func_tensor_scalar(A, B, out0=A) |
0 commit comments