Skip to content

Commit 1c4f22e

Browse files
committed
Clean up versioning for int8 aiu op
Signed-off-by: Andrea Fasoli <[email protected]>
1 parent f61c561 commit 1c4f22e

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

fms_mo/aiu_addons/i8i8/i8i8_aiu_op.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ def implement_op_decorator(op_namespace_id):
3636
Always compare against pytorch version in current environment.
3737
"""
3838

39-
torch_version = Version(torch.__version__.split("+", maxsplit=1)[0])
40-
4139
def decorator(func):
42-
if torch_version < Version("2.4"):
40+
if Version(torch.__version__) < Version("2.4"):
4341
return torch.library.impl(op_namespace_id, "default")(func)
4442
return torch.library.custom_op(op_namespace_id, mutates_args=())(func)
4543

@@ -51,10 +49,8 @@ def register_op_decorator(op_namespace_id):
5149
Always compare against pytorch version in current environment.
5250
"""
5351

54-
torch_version = Version(torch.__version__.split("+", maxsplit=1)[0])
55-
5652
def decorator(func):
57-
if torch_version < Version("2.4"):
53+
if Version(torch.__version__) < Version("2.4"):
5854
return torch.library.impl_abstract(op_namespace_id)(func)
5955
return torch.library.register_fake(op_namespace_id)(func)
6056

@@ -73,7 +69,7 @@ def register_aiu_i8i8_op():
7369
logger.warning("AIU op has already been registered")
7470
return
7571
op_namespace_id = "fms_mo::i8i8_aiu"
76-
if Version(torch.__version__.split("+", maxsplit=1)[0]) < Version("2.4"):
72+
if Version(torch.__version__) < Version("2.4"):
7773
torch.library.define(
7874
op_namespace_id,
7975
"(Tensor x, Tensor weight, Tensor bias, Tensor qdata, "

0 commit comments

Comments
 (0)