[torch.compile] fix cpu broken code (#9947)
Signed-off-by: youkaichao <youkaichao@gmail.com>
This commit is contained in:
parent
a78dd3303e
commit
af7380d83b
@ -1551,7 +1551,14 @@ def direct_register_custom_op(
|
||||
"""
|
||||
if is_in_doc_build():
|
||||
return
|
||||
schema_str = torch.library.infer_schema(op_func, mutates_args=mutates_args)
|
||||
import torch.library
|
||||
if hasattr(torch.library, "infer_schema"):
|
||||
schema_str = torch.library.infer_schema(op_func,
|
||||
mutates_args=mutates_args)
|
||||
else:
|
||||
# for pytorch 2.4
|
||||
import torch._custom_op.impl
|
||||
schema_str = torch._custom_op.impl.infer_schema(op_func, mutates_args)
|
||||
my_lib = target_lib or vllm_lib
|
||||
my_lib.define(op_name + schema_str)
|
||||
my_lib.impl(op_name, op_func, "CUDA")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user