Skip to content

Commit

Permalink
[Operator] Register missing math primitives (#134)
Browse files Browse the repository at this point in the history
Closes #450.

Output of the example code provided in the issue:
```
/home/jack/dev/hidet/venv/bin/python3.8 /home/jack/.config/JetBrains/RemoteDev-PY/_home_jack_dev_hidet/scratches/scratch_2.py 
Compiling cpu task tan(x=float32(2, 2), y=float32(2, 2))...
Tensor(shape=(2, 2), dtype='float32', device='cpu')
[[  0.2568644  -1.0825194]
 [-32.35311    -1.5977247]]
```
jacklee1792 authored and vadiklyutiy committed Jul 23, 2024
1 parent 37c75a6 commit 61b0052
Showing 2 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions python/hidet/ir/primitives/cpu/math/float16.py
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ def register():
'log10': 'log10',
'log1p': 'log1p',
'trunc': 'trunc',
'isfinite': 'isfinite',
'isinf': 'isinf',
'isnan': 'isnan',
}
20 changes: 15 additions & 5 deletions python/hidet/ir/primitives/math.py
Original file line number Diff line number Diff line change
@@ -206,19 +206,29 @@ def register():
unary_names = [
'sin',
'cos',
'tan',
'sinh',
'cosh',
'tanh',
'asin',
'acos',
'atan',
'asinh',
'acosh',
'atanh',
'exp',
'round',
'abs',
'floor',
'ceil',
'expm1',
'erf',
'sqrt',
'rsqrt',
'erf',
'log',
'log2',
'log10',
'log1p',
'round',
'abs',
'ceil',
'floor',
'trunc',
'isfinite',
'isinf',

0 comments on commit 61b0052

Please sign in to comment.