delu.data.FnDataset.__init__#
- FnDataset.__init__(fn, args, transform=None)[source]#
Initialize self.
- Parameters
fn (Callable[[...], delu.data.T]) – the function that produces values based on arguments from
args
args (Union[int, Iterable]) – arguments for
fn
. If an iterable, but not a list, then is casted to a list. If an integer, then the behavior is the same as forlist(range(args))
. The size ofargs
defines the return value forFnDataset.__len__
.transform (Optional[Callable[[delu.data.T], Any]]) – if presented, is applied to the return value of
fn
inFnDataset.__getitem__
- Return type
Examples
import PIL.Image as Image import torchvision.transforms as T dataset = FnDataset(Image.open, filenames, T.ToTensor())