@@ -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