Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove args and kwargs from AffineQuantizedTensor #247

Merged
merged 2 commits into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions torchao/quantization/subclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,18 +670,18 @@ def __new__(
quant_max: Optional[int] = None,
zero_point_domain: ZeroPointDomain = ZeroPointDomain.INT,
dtype=None,
# TODO: remove args and kwargs
*args,
**kwargs
strides=None,
):
kwargs = {}
kwargs["device"] = int_data.device
kwargs["layout"] = (
kwargs.get("layout") if kwargs.get("layout", False) else int_data.layout
)
if dtype is None:
dtype = scale.dtype
kwargs["dtype"] = dtype
assert not kwargs.get("requires_grad", False)
if strides is not None:
kwargs["strides"] = strides
kwargs["requires_grad"] = False
return torch.Tensor._make_wrapper_subclass(cls, shape, **kwargs) # type: ignore[attr-defined]

Expand All @@ -696,8 +696,7 @@ def __init__(
quant_max: Optional[int] = None,
zero_point_domain: ZeroPointDomain = ZeroPointDomain.INT,
dtype=None,
*args,
**kwargs
strides=None,
):
self.int_data = int_data
self.scale = scale
Expand Down Expand Up @@ -912,6 +911,7 @@ def _apply_fn_to_data(self, fn):
self.quant_max,
self.zero_point_domain,
dtype=self.dtype,
strides=self.stride(),
)

@classmethod
Expand Down
Loading