@@ -187,7 +187,7 @@ def __tensor_unflatten__(
187187 )
188188
189189 @classmethod
190- def from_float (
190+ def from_hp_to_intx (
191191 cls ,
192192 input_float : torch .Tensor ,
193193 mapping_type : MappingType ,
@@ -213,16 +213,16 @@ def from_float(
213213 group_size = max (block_size )
214214 compute_dtype = zero_point_dtype if (zero_point_dtype is not None ) else input_float .dtype
215215 device = input_float .device
216- int_data , scale , zero_point , _ = quantize_affine_hqq (input_float , nbits = nbits , group_size = group_size , axis = axis , compute_dtype = compute_dtype , device = device , verbose = False , raw_output = False )
217- int_data = int_data .to (target_dtype )
216+ data , scale , zero_point , _ = quantize_affine_hqq (input_float , nbits = nbits , group_size = group_size , axis = axis , compute_dtype = compute_dtype , device = device , verbose = False , raw_output = False )
217+ data = data .to (target_dtype )
218218 else :
219219 scale , zero_point = choose_qparams_affine (input_float , mapping_type , block_size , target_dtype , quant_min , quant_max , eps , scale_dtype , zero_point_dtype , preserve_zero , zero_point_domain )
220- int_data = quantize_affine (input_float , block_size , scale , zero_point , target_dtype , quant_min , quant_max , zero_point_domain )
220+ data = quantize_affine (input_float , block_size , scale , zero_point , target_dtype , quant_min , quant_max , zero_point_domain )
221221 # Note: output will be uint8 tensor for sub byte tensors for now
222222
223- int_data = layout_type .post_process (int_data )
223+ data = layout_type .post_process (data )
224224 layout_tensor_ctr = get_layout_tensor_constructor (type (layout_type ))
225- layout_tensor = layout_tensor_ctr (int_data , scale , zero_point , layout_type )
225+ layout_tensor = layout_tensor_ctr (data , scale , zero_point , layout_type )
226226 return cls (
227227 layout_tensor ,
228228 block_size ,
@@ -234,7 +234,7 @@ def from_float(
234234 )
235235
236236 @classmethod
237- def from_float_static (
237+ def from_hp_to_intx_static (
238238 cls ,
239239 input_float : torch .Tensor ,
240240 scale : torch .Tensor ,
@@ -266,15 +266,15 @@ def from_float_static(
266266 )
267267
268268 @classmethod
269- def from_float_to_floatx (
269+ def from_hp_to_floatx (
270270 cls ,
271271 input_float : torch .Tensor ,
272272 block_size : Tuple [int , ...],
273273 target_dtype : torch .dtype = torch .float8_e4m3fn ,
274274 layout_type : LayoutType = PlainLayoutType (),
275275 ):
276276 if target_dtype in FP8_TYPES :
277- cls .from_float (
277+ return cls .from_hp_to_intx (
278278 input_float = input_float ,
279279 mapping_type = MappingType .SYMMETRIC ,
280280 block_size = block_size ,
@@ -1004,9 +1004,9 @@ def _(func, types, args, kwargs):
10041004 )
10051005 return return_and_correct_aliasing (func , args , kwargs , new )
10061006
1007- to_affine_quantized = AffineQuantizedTensor .from_float
1008- to_affine_quantized_static = AffineQuantizedTensor .from_float_static
1009- to_affine_quantized_floatx = AffineQuantizedTensor .from_float_to_floatx
1007+ to_affine_quantized_intx = AffineQuantizedTensor .from_hp_to_intx
1008+ to_affine_quantized_intx_static = AffineQuantizedTensor .from_hp_to_intx_static
1009+ to_affine_quantized_floatx = AffineQuantizedTensor .from_hp_to_floatx
10101010
10111011if TORCH_VERSION_AT_LEAST_2_5 :
10121012 # Allow a model with AffineQuantizedTensor weights to be loaded with `weights_only=True`
0 commit comments