You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the example below, for the dataset with the $.getitem() implementation, the [ method returns an element without batch dimension for an index of length 1, and otherwise includes the batch dimension. I think it would be better to have this consistent and always return the batch dimension.
Ok, I realized that this is because [.dataset just calls into $.getitem() with whatever indices are provided.
I am not sure what the correct behavior here is, but I think the current implementation is somewhat inconsistent.
One suggestion would be to make [.dataset err when there is more than one index provided (for datsets that implement only $.getitem(). We can't just cat along the first dimension because the returned tensors might have varying shapes.
Also for consistency I think that [.dataset should include the batch dimension when called with a single index on a dataset that implements $.getitem.
I agree with your second suggestion [ should ibnclude the batch dimension when called with a single index on a dataset that only implements .getitem(). We could implement [[ to extract a single element by index, with .getitem().
But the question is still whether ds[1:2] should throw an error if ds implements $.getitem(). The different tensors might have varying shapes, so it's not always possible to torch_cat() them.
Yes, maybe a simpler solution is to error if it only implements .getitem() but then, I don't think we should include the batch dimension in this case. Maybe just allow [[ if .getitem is implemented. And make [ for .getbatch.
In the example below, for the dataset with the
$.getitem()
implementation, the[
method returns an element without batch dimension for an index of length 1, and otherwise includes the batch dimension. I think it would be better to have this consistent and always return the batch dimension.Created on 2025-04-17 with reprex v2.1.1
The text was updated successfully, but these errors were encountered: