Skip to content

Commit

Permalink
Fix __repr__
Browse files Browse the repository at this point in the history
  • Loading branch information
RichieHakim committed Feb 11, 2024
1 parent 2cbfdd4 commit 74d5ad3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions vqt/vqt.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,11 @@ def __repr__(self):
if self.using_custom_filters:
return f"VQT with custom filters"
else:
# return f"VQT object with parameters: {''.join([f'{k}={getattr(self, k)}, ' for k, v in self.__dict__.items() if k not in ['filters', 'freqs', 'wins']])[:-2]}"
## Below lines are because torch.jit.script doesn't allow comprehension if statements
attributes_to_print = []
for k, v in self.__dict__.items():
if k not in ['filters', 'freqs', 'wins']:
if (k not in ['filters', 'freqs', 'wins']) and (not k.startswith('_')) and (not callable(v)):
attributes_to_print.append(k)
return f"VQT object with parameters: {''.join([f'{k}={getattr(self, k)}, ' for k in attributes_to_print])[:-2]}"

return f"VQT object with parameters: {''.join([f'{k}={getattr(self, k)}, ' for k in attributes_to_print])[:-2]}"


def downsample(
Expand Down

0 comments on commit 74d5ad3

Please sign in to comment.