1313# limitations under the License.
1414"""Pytest configuration file with fixtures for add-ons functionality testing"""
1515
16+ # Standard
17+ from pathlib import Path
18+
1619# Third Party
1720import pytest
1821import torch
19- from pathlib import Path
2022
2123# ================================================
2224# GPTQ W4A16 fixtures
@@ -84,15 +86,15 @@ def get_gptq_gemm_inputs(request) -> tuple[torch.Tensor, ...]:
8486def get_i8i8_gemm_inputs (
8587 request ,
8688) -> tuple [
87- torch .Tensor ,
88- torch .Tensor ,
89- torch .Tensor ,
90- torch .Tensor ,
91- str ,
92- str ,
93- bool ,
94- torch .Tensor ,
95- ]:
89+ torch .Tensor ,
90+ torch .Tensor ,
91+ torch .Tensor ,
92+ torch .Tensor ,
93+ str ,
94+ str ,
95+ bool ,
96+ torch .Tensor ,
97+ ]:
9698 """pytest fixture returning test inputs for INT8xINT8 op"""
9799
98100 data = request .param
@@ -110,7 +112,7 @@ def get_i8i8_gemm_inputs(
110112 assert data ["atype" ] == i8i8_data ["activ_quant_type" ]
111113 assert data ["smoothquant" ] == i8i8_data ["smoothquant" ]
112114 assert all (
113- [ item in i8i8_data for item in ["x" , "w_int" , "bias" , "qdata" , "reference_out" ] ]
115+ item in i8i8_data for item in ["x" , "w_int" , "bias" , "qdata" , "reference_out" ]
114116 )
115117
116118 return (
@@ -123,25 +125,3 @@ def get_i8i8_gemm_inputs(
123125 i8i8_data ["smoothquant" ],
124126 i8i8_data ["reference_out" ],
125127 )
126-
127-
128- def create_qdata (
129- wtype : str ,
130- atype : str ,
131- in_feat : int ,
132- out_feat : int ,
133- smoothquant : bool ,
134- dtype : torch .dtype ,
135- ) -> torch .Tensor :
136- """Generate dummy qdata tensor based on the provided quantization configuration"""
137-
138- qdata_len = 2 if wtype == "per_tensor" else 2 * out_feat # weight clips
139- qdata_len += 2 # activation clips
140- qdata_len += out_feat if atype == "per_tensor_asymm" else 1 # zero shift
141- qdata_len += in_feat if smoothquant else 1 # smoothquant scales
142-
143- # TODO: improve dummy generation
144- qdata = torch .ones (qdata_len , dtype = dtype )
145- qdata [1 ] = - qdata [0 ] # !!! temporary solution to enforce clip symmetry
146- qdata [3 ] = - qdata [2 ]
147- return qdata
0 commit comments