Skip to content

Commit 81fe1bd

Browse files
simplify LinearFPx repr str
Signed-off-by: cliu-us <[email protected]>
1 parent 50648c7 commit 81fe1bd

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

fms_mo/modules/linear.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,10 +2076,17 @@ def extra_repr(self) -> str:
20762076
"""
20772077
Returns an alternative string representation of the object.
20782078
"""
2079-
return (
2080-
f"in={self.in_features}, out={self.out_features}, bias={self.bias is not None}, "
2081-
f"trun_bits={self.trun_bits},fp8_dyn={self.fp8_dyn},chunk_size={self.chunk_size}"
2082-
)
2079+
repr_str = f"{self.in_features},{self.out_features}"
2080+
if self.bias is not None:
2081+
repr_str += f",bias={self.bias is not None}"
2082+
if self.trun_bits > 0:
2083+
repr_str += f",trun_bits={self.trun_bits}"
2084+
if self.fp8_dyn:
2085+
repr_str += f",fp8_dyn={self.fp8_dyn}"
2086+
if self.clamp_acc_to_dl16:
2087+
repr_str += f",use_DL16_acc"
2088+
repr_str += f",chunk_size={self.chunk_size}"
2089+
return repr_str
20832090

20842091

20852092
class LinearFuncINT8FwdFP32Bwd(torch.autograd.Function):

0 commit comments

Comments
 (0)