Skip to content

Commit 167292a

Browse files
committed
Make printing of MXLinear and MXInferenceLinear more descriptive
Summary: For now, at least print the config. It's pretty verbose, we can make the string more concise in a future PR. Test Plan: CI Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: c4cc7e9 ghstack-comment-id: 2722102724 Pull Request resolved: #1883
1 parent dfc3338 commit 167292a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

torchao/prototype/mx_formats/mx_linear.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ def forward(self, x):
159159
y = y + self.bias
160160
return y
161161

162+
def extra_repr(self):
163+
s = f"{super().extra_repr()}, config={self.config}"
164+
return s
165+
162166

163167
class MXInferenceLinear(torch.nn.Linear):
164168
"""
@@ -201,6 +205,10 @@ def forward(self, x):
201205
y = F.linear(x, w_hp, self.bias)
202206
return y
203207

208+
def extra_repr(self):
209+
s = f"{super().extra_repr()}, config={self.config}"
210+
return s
211+
204212

205213
def replace_with_custom_fn_if_matches_filter(
206214
model, replacement_fn, filter_fn, cur_fqn=""

0 commit comments

Comments
 (0)