LukasHedegaard / datasetops

Fluent dataset operations, compatible with your favorite libraries
https://datasetops.readthedocs.io
MIT License
10 stars 1 forks source link

Remove `extend` from Loader #31

Open LukasHedegaard opened 4 years ago

LukasHedegaard commented 4 years ago

Currently, there may be issues if a Loader dataset has no elements. Methods that require shape, (named for instance) will not work. There is currently a temptation to create datasets as follows:

ds = Loader(getitems_fn).named(“image”, “label”)
ds.extend(ids)

This fails because the named function is only valid after extend was called.

Removing extend from the Loader and instead pass ids via the constructor would avoid the scenario. Also, it conforms better to our otherwise functional API

ds = Loader(getitems_fn, ids).named(“image”, “label”)
LukasHedegaard commented 4 years ago

Fixed in https://github.com/LukasHedegaard/datasetops/pull/34