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

Add free-standing function to concatenate datasets #10

Merged
merged 4 commits into from
Mar 28, 2019

Conversation

tglarner
Copy link
Member

This branch adds a free-standing function to create a new datset as the concatenation of others. That way the usage of the instance method Dataset as a class method is sidestepped and user code becomes less confusing.

@tglarner tglarner closed this Mar 28, 2019
@boeddeker
Copy link
Member

What do you think about the special case, that the input to concatenate is only one dataset?
To reduce the iteration overhead, there could be a short path:

if len(datasets) == 1:
    return datasets[0]

@tglarner
Copy link
Member Author

tglarner commented Mar 28, 2019

Good point. Furthermore, this increases symmetry ith the member function. Short circuiting is implemented with commit 0e47822

@tglarner tglarner reopened this Mar 28, 2019
@jheymann85
Copy link
Member

Maybe datasets should be a list so behavior is the same as in numpy, tf, pytorch etc.

@tglarner
Copy link
Member Author

We could do that, but I tried to stay as close as possible to the corresponding member function. If we would change this here, we should change it in the member function as well. However, that would be a breaking change and would thus need another pull request.

@boeddeker
Copy link
Member

Good point with the compatibility. We should try to support code that is valid in other software.
How about to support both?

@tglarner
Copy link
Member Author

I have no objections to the suggestion, but I suggest that we merge this pull request and open a separate issue which we can adress with another pull request in the near future.

@boeddeker
Copy link
Member

You are right. This PR is fine. I will merge it.

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.

None yet

3 participants