Adds a bunch of input checks when creating a Frame or a FrameBatch. We enforce Frame data to be 3D, and FrameBatch data to be >= 4D. We also ensure consistency of leading dimensions between data, pts_seconds and duration_seconds
Adds indexing support for FrameBatch. This supports pytorch fancy indexing naturally and intuitively. Note that indexing a 4D FrameBatch returns a Frame.
Adds iteration support for FrameBatch. This removes the "tuple unpacking" behavior that we had for FrameBatch, but luckily this is not something we have been using at all. The unpacking behavior of Frame is preserved.
These changes are mostly necessary in order for us to change the output of the samples from List[FrameBatch(4D)] to FrameBatch (5D), as done in https://github.com/pytorch/torchcodec/pull/284
This PR:
Frame
or aFrameBatch
. We enforceFrame
data to be 3D, andFrameBatch
data to be >= 4D. We also ensure consistency of leading dimensions between data, pts_seconds and duration_secondsFrameBatch
. This supports pytorch fancy indexing naturally and intuitively. Note that indexing a 4DFrameBatch
returns aFrame
.FrameBatch
. This removes the "tuple unpacking" behavior that we had forFrameBatch
, but luckily this is not something we have been using at all. The unpacking behavior ofFrame
is preserved.These changes are mostly necessary in order for us to change the output of the samples from
List[FrameBatch(4D)]
toFrameBatch (5D)
, as done in https://github.com/pytorch/torchcodec/pull/284