Skip to content

Commit

Permalink
Merge pull request #8 from AdeelH/repr-reduction-quotes
Browse files Browse the repository at this point in the history
Put quotes around string values in `__repr__()` output
  • Loading branch information
AdeelH committed Oct 12, 2022
2 parents 6359c1e + e5ef26b commit 96bb124
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions focal_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def __init__(self,
def __repr__(self):
arg_keys = ['alpha', 'gamma', 'ignore_index', 'reduction']
arg_vals = [self.__dict__[k] for k in arg_keys]
arg_vals = [f'\'{v}\'' if isinstance(v, str) else v for v in arg_vals]
arg_strs = [f'{k}={v}' for k, v in zip(arg_keys, arg_vals)]
arg_str = ', '.join(arg_strs)
return f'{type(self).__name__}({arg_str})'
Expand Down

0 comments on commit 96bb124

Please sign in to comment.