#pragma once #include #include #include namespace torch { namespace data { namespace transforms { /// A `Collation` is a transform that reduces a batch into a single value. /// The result is a `BatchDataset` that has the type of the single value as its /// `BatchType`. template > using Collation = BatchTransform; /// A `Collate` allows passing a custom function to reduce/collate a batch /// into a single value. It's effectively the lambda version of `Collation`, /// which you could subclass and override `operator()` to achieve the same. /// /// \rst /// .. code-block:: cpp /// using namespace torch::data; /// /// auto dataset = datasets::MNIST("path/to/mnist") /// .map(transforms::Collate>([](std::vector> e) { /// return std::move(e.front()); /// })); /// \endrst template > using Collate = BatchLambda; } // namespace transforms } // namespace data } // namespace torch