hidet-org/hidet

[Bug] hidet.ops.tan cannot work

CBalaa opened this issue · 1 comments

Describe the bug
I found that hidet.ops.tan cannot work, the following is a part of traceback info:

Traceback (most recent call last):
  File "/root/test/test/test.py", line 6, in <module>
    y = ops.tan(hidet.from_torch(x))
  File "/root/miniconda3/envs/smore/lib/python3.10/site-packages/hidet/graph/ops/arithmetic.py", line 893, in tan
    return TanOp(x).outputs[0]
  File "/root/miniconda3/envs/smore/lib/python3.10/site-packages/hidet/graph/ops/arithmetic.py", line 452, in __init__
    super().__init__(x, op=lambda a: primitives.tan(a), name='tan')
  File "/root/miniconda3/envs/smore/lib/python3.10/site-packages/hidet/graph/ops/arithmetic.py", line 268, in __init__
    self.op = UnaryElementwiseOperation.from_callable(op, name, attributes, task_attributes)
  File "/root/miniconda3/envs/smore/lib/python3.10/site-packages/hidet/graph/ops/arithmetic.py", line 46, in from_callable
    y = op(x)
  File "/root/miniconda3/envs/smore/lib/python3.10/site-packages/hidet/graph/ops/arithmetic.py", line 452, in <lambda>
    super().__init__(x, op=lambda a: primitives.tan(a), name='tan')
  File "/root/miniconda3/envs/smore/lib/python3.10/site-packages/hidet/ir/primitives/math.py", line 372, in tan
    return generic_math_function_set.tan(a)
  File "/root/miniconda3/envs/smore/lib/python3.10/site-packages/hidet/ir/primitives/math.py", line 253, in tan
    return self.call('tan', a)
  File "/root/miniconda3/envs/smore/lib/python3.10/site-packages/hidet/ir/primitives/math.py", line 241, in call
    entry = lookup_primitive_function(f'generic_{name}')
  File "/root/miniconda3/envs/smore/lib/python3.10/site-packages/hidet/ir/primitives/func.py", line 105, in lookup_primitive_function
    return primitive_func_pool.lookup_by_name(name)
  File "/root/miniconda3/envs/smore/lib/python3.10/site-packages/hidet/ir/primitives/func.py", line 77, in lookup_by_name
    raise ValueError(
ValueError: Can not find primitive function with key: generic_tan, candidates:
generic_sin
generic_cos
generic_tanh
generic_exp
generic_round
generic_abs
generic_floor
generic_ceil
generic_sqrt
generic_rsqrt
generic_erf
...

To Reproduce

The following is my code for test:

import hidet
import torch
from hidet import ops

x = torch.randn([2, 2])
y = ops.tan(hidet.from_torch(x))
print(y)

Expected behavior
I hope it work normally.

Enviroment

  • OS: Ubuntu 22.04

  • Others: hidet version: 0.3.0

Hi @CBalaa ,

Thanks so much for trying out Hidet and reporting this bug! This bug has already been fixed in our internal branch, which will be released as part of our 0.4.0 release milestone (i.e., end of June). As a reference to other people who might've encountered the same bug, I'll keep this issue open until 0.4.0 is actually released. Stay tuned!