You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
there could be some issues of child class modifying the dispatch table for parent class, if this becomes an issue, we can add class to the dispatch table as well in the future.
Summary:
Fixes: pytorch#698
Also added `TorchAOBaseTensor` addressing part of pytorch#710
Test Plan:
python test/dtypes/test_affine_quantized.py
Reviewers:
Subscribers:
Tasks:
Tags:
A lot of code for tensor subclasses can likely be conslidated together into a base class that other classes can utilize
_get_to_kwargs:
https://github.com/pytorch/ao/blob/main/torchao/dtypes/affine_quantized_tensor.py#L64
https://github.com/pytorch/ao/blob/main/torchao/dtypes/affine_quantized_tensor.py#L276
(also needed for https://github.com/pytorch/ao/blob/main/torchao/quantization/autoquant.py#L40)
to:
https://github.com/pytorch/ao/blob/main/torchao/dtypes/affine_quantized_tensor.py#L594
https://github.com/pytorch/ao/blob/main/torchao/dtypes/affine_quantized_tensor.py#L290
https://github.com/pytorch/ao/blob/main/torchao/dtypes/affine_quantized_tensor.py#L423
(also needed for https://github.com/pytorch/ao/blob/main/torchao/quantization/autoquant.py#L40)
_apply_fn_to_data:
https://github.com/pytorch/ao/blob/main/torchao/dtypes/affine_quantized_tensor.py#L432
detach:
https://github.com/pytorch/ao/blob/main/torchao/dtypes/affine_quantized_tensor.py#L444
a default repr would be nice (it caused bugs in the past)
if these were implemented using tensor_flatten and tensor_unflatten e.g. https://github.com/pytorch/ao/blob/main/torchao/dtypes/affine_quantized_tensor.py#L412-L421
you could write a general mixin/parent class that handles the general form of those methods
The text was updated successfully, but these errors were encountered: