|
10 | 10 |
|
11 | 11 | """ |
12 | 12 |
|
| 13 | +from typing import cast |
| 14 | + |
13 | 15 | import torch |
14 | 16 | import torch.nn.functional as F |
| 17 | + |
15 | 18 | from executorch.backends.arm.ao_ext.mxfp import ( |
16 | 19 | _cast_to_block_scaled_cpu_ref, |
17 | 20 | mxfp_dtype_to_str, |
@@ -257,6 +260,24 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: |
257 | 260 | output = output.to(self.output_dtype) |
258 | 261 | return output |
259 | 262 |
|
| 263 | + def extra_repr(self) -> str: |
| 264 | + weight_qdata = cast(torch.Tensor, self.weight_qdata) |
| 265 | + weight_shape = weight_qdata.shape |
| 266 | + in_channels = _get_num_input_channels(weight_qdata, self.weight_dtype) |
| 267 | + repr_parts = [ |
| 268 | + f"in_channels={in_channels}", |
| 269 | + f"out_channels={weight_shape[0]}", |
| 270 | + f"kernel_size={(weight_shape[1], weight_shape[2])}", |
| 271 | + f"stride={self.stride}", |
| 272 | + f"padding={self.padding}", |
| 273 | + f"dilation={self.dilation}", |
| 274 | + f"groups={self.groups}", |
| 275 | + f"bias={self.bias is not None}", |
| 276 | + f"weight_dtype={self.weight_dtype}", |
| 277 | + f"block_size={self.block_size}", |
| 278 | + ] |
| 279 | + return ", ".join(repr_parts) |
| 280 | + |
260 | 281 |
|
261 | 282 | def transform_conv2d_to_mxfp( |
262 | 283 | module: torch.nn.Module, |
|
0 commit comments