Skip to content

Commit 96bb124

Browse files
authored
Merge pull request #8 from AdeelH/repr-reduction-quotes
Put quotes around string values in `__repr__()` output
2 parents 6359c1e + e5ef26b commit 96bb124

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

focal_loss.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def __init__(self,
5151
def __repr__(self):
5252
arg_keys = ['alpha', 'gamma', 'ignore_index', 'reduction']
5353
arg_vals = [self.__dict__[k] for k in arg_keys]
54+
arg_vals = [f'\'{v}\'' if isinstance(v, str) else v for v in arg_vals]
5455
arg_strs = [f'{k}={v}' for k, v in zip(arg_keys, arg_vals)]
5556
arg_str = ', '.join(arg_strs)
5657
return f'{type(self).__name__}({arg_str})'

0 commit comments

Comments
 (0)