I’m trying to use get_items to return both my inputs and targets … but for some reason, it thinks that what I’m returning is just my inputs (and so when I call dsets.train[0] I see everything duplicated).
We don’t need neither get_x nor get_x because the getters is None in the example above, and that triggers the automatic creation of get_x (getters[0]), and get_y (getters[1]) in the from_columns() method like this (Notice that since blocks is None, range is set to 2 in the for loop):
if getters is None: getters = L(ItemGetter(i) for i in range(2 if blocks is None else len(L(blocks))))
Here is the definition of from_columns() method found in block.py file
class DataBlock():
"Generic container to quickly build `Datasets` and `DataLoaders`"
...
@classmethod
def from_columns(cls, blocks=None, getters=None, get_items=None, **kwargs):
if getters is None: getters = L(ItemGetter(i) for i in range(2 if blocks is None else len(L(blocks))))
get_items = _zip if get_items is None else compose(get_items, _zip)
return cls(blocks=blocks, getters=getters, get_items=get_items, **kwargs)