OpenMined / SwiftSyft

The official Syft worker for iOS, built in Swift
Apache License 2.0
50 stars 17 forks source link

`LazyDataLoader` that loads batches of data lazily #182

Closed mjjimenez closed 3 years ago

mjjimenez commented 4 years ago

Feature Description

Currently, we have DataLoader abstract like class (along with other concrete implementations in TensorDataLoader and MultiTensorDataLoader in SwiftSyft that is analogous to PyTorch's torch.utils.data.DataLoader. These classes take in a collection of tensors, shuffles them and batches them together. The SwiftSyft implementation of DataLoaders are equal to a PyTorch DataLoader that takes a map-style dataset since those dataset types can be shuffled.

Another set of DataLoaders we need will be ones that can take in a lazily evaluated sequence of elements. Similar to the current DataLoader, the new LazyDataLoader will instead take in a Swift Sequence of TorchTensors that cannot be shuffled (because they are lazily evaluated) and batch them similar to the logic in the current implementation of SwiftSyft DataLoader.

API

What alternatives have you considered?

Considered implementing all the logic in one class but it was too difficult by just using generics.