Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[src & tests & egs] Refactor utils files into folder #120

Merged
merged 7 commits into from
May 25, 2020

Conversation

mpariente
Copy link
Collaborator

More and more utils files are going to come up (hopefully not too many), so it's time to make an utils folder. It seemed overkill at the time but it would have be better.

The functions are also migrated into more meaningful files (torch_utils.py contains all the torch related utils now).

All the changes are done to maximize backward compatibility (BC) but I could not reach it perfectly.

Things which didn't change

from asteroid.utils import prepare_parser_from_dict
from asteroid.utils import tensors_to_device # Changed but accessible
from asteroid import torch_utils  # global asteroid import

What did change

As torch_utils.py is imported in asteroid/__init__.py for BC, former function from the asteroid/torch_utils.py "package" cannot be imported as follows

from asteroid.torch_utils import pad_x_to_y   # this breaks

Replace by

from asteroid import torch_utils 
torch_utils.pad_x_to_y(...)  # this works.

@mpariente mpariente merged commit a0b1d5e into master May 25, 2020
@mpariente mpariente deleted the utils_refactor branch May 26, 2020 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant