PadListDataCollate transform #1813
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #1795 (comment).
part of #1515
Description
Create transform that in the forward direction takes a batch of data and centrally pads any tensors to the maximum size of each dimension of all images in the batch.
The inverse acts on a dictionary containing the data for 1 dataset.
I find the asymmetry between the forward and inverse a little ugly, but I can't really see any other way about it. The only reason we need the whole batch in the forward direction is so that we can find out the required padding size. However, in the inverse direction, we want to deal with them individually so that we can take advantage of multiprocessing.
I should note that the asymmetry is mostly hidden from the user who wouldn't call this directly. Instead, they would pass the forward as the
collate_fnfor aDataLoader, and then theinversewould be called automatically when doing batch inversion.Status
Ready
Types of changes
./runtests.sh -f -u --net --coverage../runtests.sh --quick --unittests.make htmlcommand in thedocs/folder.