Skip to content

Commit 2477bf6

Browse files
authored
Merge pull request #9 from AdeelH/repr-simplify
Simpler implementation of #8
2 parents 96bb124 + e1dd0e8 commit 2477bf6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

focal_loss.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +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]
55-
arg_strs = [f'{k}={v}' for k, v in zip(arg_keys, arg_vals)]
54+
arg_strs = [f'{k}={v!r}' for k, v in zip(arg_keys, arg_vals)]
5655
arg_str = ', '.join(arg_strs)
5756
return f'{type(self).__name__}({arg_str})'
5857

0 commit comments

Comments
 (0)