We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, I'm using a Dataset class (extending torch.utils.data.Dataset) which contains this method:
def __getitem__(self, idx) -> tuple[list[torch.Tensor], torch.Tensor]
Unfortunately, the split_data_target in torchensemble.utils.io can't handle that.
split_data_target
torchensemble.utils.io
if len(element) == 2: # Dataloader with one input and one target data, target = element[0], element[1] return [data.to(device)], target.to(device)
maybe this modification would be useful:
if len(element) == 2: # Dataloader with one input and one target data, target = element[0], element[1] if isinstance(data, list) or isinstance(data, tuple): return [d.to(device) for d in data], target.to(device) return [data.to(device)], target.to(device)# tensor -> list
The text was updated successfully, but these errors were encountered:
def getitem(self, idx) -> tuple[list[torch.Tensor], torch.Tensor]
Hi @jfulem, is this specification of dataset generally used? Will appreciate your suggestions very much.
Sorry, something went wrong.
Yes, getting this tuple[list[torch.Tensor], torch.Tensor] as the dataset item is very common.
tuple[list[torch.Tensor], torch.Tensor]
Marked as a new feature, are you willing to work on this @jfulem ?
@xuyxu, sure I can make the PR.
No branches or pull requests
Hi, I'm using a Dataset class (extending torch.utils.data.Dataset) which contains this method:
Unfortunately, the
split_data_target
intorchensemble.utils.io
can't handle that.maybe this modification would be useful:
The text was updated successfully, but these errors were encountered: