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

Iheriting the Dataset class #532

Closed
RawEnchilada opened this issue Apr 11, 2023 · 1 comment
Closed

Iheriting the Dataset class #532

RawEnchilada opened this issue Apr 11, 2023 · 1 comment
Assignees
Milestone

Comments

@RawEnchilada
Copy link

My question is somewhat related to #529

I require a custom dataset to train my model with, but i can't find any good explanations for it.

The documentation about Dataset, DataLoader and DataBatch classes are not very clear. I have created a custom dataset class that inherits the original Dataset, but it requires a createDataBatch function to be implemented that returns a DataBatch instance.
DataBatch doesn't have a public constructor so how can this be achieved?

@juliabeliaeva
Copy link
Contributor

@RawEnchilada it seems that this is a bug, sorry about that. There is a workaround though: it looks like the internal constructor can still be referenced from java code. So one idea is that temporarily you can add a java class like so:

public class DataBatchUtil {
    public static DataBatch createBatch(float[][] x, float[] y, int size) {
        return new DataBatch(x, y, size);
    }
}

And use this utility class to create new data batches. This is a bit ugly, but should work temporarily.

Other alternative is maybe not implementing a new DataSet but reusing available implementations. What is your use case, perhaps it can be implemented without a new class?

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

No branches or pull requests

2 participants