You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered an issue where using TORCH_LIBRARY alone, without the dispatcher API, does not work as expected. According to the PyTorch documentation, the TORCH_LIBRARY macro should create a function that registers custom operators. However, when I follow this approach, I get the following error during runtime:
$ python test/benchmark.py cuda
Traceback (most recent call last):
File "/home/lizhifei/extension-cpp/test/benchmark.py", line 48, in <module>
new_h, new_C = LLTM(X, W, b, h, C)
^^^^^^^^^^^^^^^^^^^
File "/home/lizhifei/miniconda3/envs/extension-cpp/lib/python3.12/site-packages/extension_cpp/ops.py", line 11, in lltm
return LLTMFunction.apply(input, weights, bias, old_h, old_cell)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lizhifei/miniconda3/envs/extension-cpp/lib/python3.12/site-packages/torch/autograd/function.py", line 598, in apply
return super().apply(*args, **kwargs) # type: ignore[misc]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lizhifei/miniconda3/envs/extension-cpp/lib/python3.12/site-packages/extension_cpp/ops.py", line 17, in forward
outputs = torch.ops.extension_cpp.lltm_forward.default(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lizhifei/miniconda3/envs/extension-cpp/lib/python3.12/site-packages/torch/_ops.py", line 921, in __getattr__
raise AttributeError(
AttributeError: '_OpNamespace' object has no attribute 'lltm_forward'
Here is a link to my modified repository where this issue can be reproduced: andylizf/extension-cpp.
Could you please help me understand why this is happening and how to resolve it? Thank you.
Environment Information
OS: Windows 11 23H2 22631.3527
PyTorch version: 2.3.0
How you installed PyTorch: conda
Python version: 3.12.3
CUDA/cuDNN version: CUDA 12.1, cuDNN 8.9.2
GPU models and configuration: NVIDIA GeForce RTX 3090
I encountered an issue where using
TORCH_LIBRARY
alone, without the dispatcher API, does not work as expected. According to the PyTorch documentation, theTORCH_LIBRARY
macro should create a function that registers custom operators. However, when I follow this approach, I get the following error during runtime:Here is a link to my modified repository where this issue can be reproduced: andylizf/extension-cpp.
Could you please help me understand why this is happening and how to resolve it? Thank you.
Environment Information
The text was updated successfully, but these errors were encountered: