問題文
A developer writes a map-style dataset for images stored on disk. Which option correctly identifies the two methods that the class must implement for a DataLoader to iterate over it with automatic batching?
選択肢
- A method returning the number of samples and a method returning the sample at a given index.
- A method returning the number of samples and a method returning a whole batch, because the loader delegates the grouping of samples into batches to the dataset so that each dataset can control its own batching strategy.
- A method returning the shape of each sample and a transform method, so the loader can size each batch before reading it.
- An iterator method only, since the loader walks the samples from the first to the last and asks for one of them at a time.