2020 "TOSA-0.80+MI+8k" ,
2121 "TOSA-0.80+BI+u55" ,
2222]
23- test_valid_1_00_strings = [
24- "TOSA-1.00.0+INT+FP+fft" ,
25- "TOSA-1.00.0+FP+bf16+fft" ,
26- "TOSA-1.00.0+INT+int4+cf" ,
27- "TOSA-1.00.0+FP+cf+bf16+8k" ,
28- "TOSA-1.00.0+FP+INT+bf16+fft+int4+cf" ,
29- "TOSA-1.00.0+FP+INT+fft+int4+cf+8k" ,
23+ test_valid_1_0_strings = [
24+ "TOSA-1.0.0+INT+FP+fft" ,
25+ "TOSA-1.0.0+FP+bf16+fft" ,
26+ "TOSA-1.0.0+INT+int4+cf" ,
27+ "TOSA-1.0.0+FP+cf+bf16+8k" ,
28+ "TOSA-1.0.0+FP+INT+bf16+fft+int4+cf" ,
29+ "TOSA-1.0.0+FP+INT+fft+int4+cf+8k" ,
30+ "TOSA-1.0+INT+FP+fft" ,
31+ "TOSA-1.0+FP+bf16+fft" ,
32+ "TOSA-1.0+INT+int4+cf" ,
33+ "TOSA-1.0+FP+cf+bf16+8k" ,
34+ "TOSA-1.0+FP+INT+bf16+fft+int4+cf" ,
35+ "TOSA-1.0+FP+INT+fft+int4+cf+8k" ,
3036]
3137
32- test_valid_1_00_extensions = {
38+ test_valid_1_0_extensions = {
3339 "INT" : ["int16" , "int4" , "var" , "cf" ],
3440 "FP" : ["bf16" , "fp8e4m3" , "fp8e5m2" , "fft" , "var" , "cf" ],
3541}
4046 "TOSA-0.80+8k" ,
4147 "TOSA-0.80+BI+MI" ,
4248 "TOSA-0.80+BI+U55" ,
43- "TOSA-1.00 .0+fft" ,
44- "TOSA-1.00 .0+fp+bf16+fft" ,
45- "TOSA-1.00 .0+INT+INT4+cf" ,
46- "TOSA-1.00 .0+BI" ,
47- "TOSA-1.00 .0+FP+FP+INT" ,
48- "TOSA-1.00 .0+FP+CF+bf16" ,
49- "TOSA-1.00 .0+BF16+fft+int4+cf+INT" ,
49+ "TOSA-1.0 .0+fft" ,
50+ "TOSA-1.0 .0+fp+bf16+fft" ,
51+ "TOSA-1.0 .0+INT+INT4+cf" ,
52+ "TOSA-1.0 .0+BI" ,
53+ "TOSA-1.0 .0+FP+FP+INT" ,
54+ "TOSA-1.0 .0+FP+CF+bf16" ,
55+ "TOSA-1.0 .0+BF16+fft+int4+cf+INT" ,
5056]
5157
5258test_compile_specs = [
5359 ([CompileSpec ("tosa_version" , "TOSA-0.80+BI" .encode ())],),
5460 ([CompileSpec ("tosa_version" , "TOSA-0.80+BI+u55" .encode ())],),
55- ([CompileSpec ("tosa_version" , "TOSA-1.00 .0+INT" .encode ())],),
61+ ([CompileSpec ("tosa_version" , "TOSA-1.0 .0+INT" .encode ())],),
5662]
5763
5864test_compile_specs_no_version = [
@@ -70,8 +76,8 @@ def test_version_string_0_80(self, version_string: str):
7076 assert isinstance (tosa_spec , Tosa_0_80 )
7177 assert tosa_spec .profile in ["BI" , "MI" ]
7278
73- @parameterized .expand (test_valid_1_00_strings ) # type: ignore[misc]
74- def test_version_string_1_00 (self , version_string : str ):
79+ @parameterized .expand (test_valid_1_0_strings ) # type: ignore[misc]
80+ def test_version_string_1_0 (self , version_string : str ):
7581 tosa_spec = TosaSpecification .create_from_string (version_string )
7682 assert isinstance (tosa_spec , Tosa_1_00 )
7783 assert [profile in ["INT" , "FP" ] for profile in tosa_spec .profiles ].count (
@@ -80,7 +86,7 @@ def test_version_string_1_00(self, version_string: str):
8086
8187 for profile in tosa_spec .profiles :
8288 assert [
83- e in test_valid_1_00_extensions [profile ] for e in tosa_spec .extensions
89+ e in test_valid_1_0_extensions [profile ] for e in tosa_spec .extensions
8490 ]
8591
8692 @parameterized .expand (test_invalid_strings ) # type: ignore[misc]
@@ -103,3 +109,15 @@ def test_create_from_invalid_compilespec(self, compile_specs: list[CompileSpec])
103109 tosa_spec = TosaSpecification .create_from_compilespecs (compile_specs )
104110
105111 assert tosa_spec is None
112+
113+ @parameterized .expand (test_valid_0_80_strings )
114+ def test_correct_string_representation_0_80 (self , version_string : str ):
115+ tosa_spec = TosaSpecification .create_from_string (version_string )
116+ assert isinstance (tosa_spec , Tosa_0_80 )
117+ assert f"{ tosa_spec } " == version_string
118+
119+ @parameterized .expand (test_valid_1_0_strings )
120+ def test_correct_string_representation_1_0 (self , version_string : str ):
121+ tosa_spec = TosaSpecification .create_from_string (version_string )
122+ assert isinstance (tosa_spec , Tosa_1_00 )
123+ assert f"{ tosa_spec } " == version_string
0 commit comments