.. _program_listing_file_src_data_dataset.h: Program Listing for File dataset.h ================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/data/dataset.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #pragma once #include "common/definitions.h" #include "common/options.h" #include "data/batch.h" #include "data/rng_engine.h" #include "data/vocab.h" #include "training/training_state.h" namespace marian { namespace data { template class DatasetBase { protected: std::vector paths_; Ptr options_; // Data processing may differ in training/inference settings bool inference_{false}; public: typedef Batch batch_type; typedef Ptr batch_ptr; // @TODO: rename to camel case typedef Iterator iterator; typedef SampleType Sample; DatasetBase(std::vector paths, Ptr options) : paths_(paths), options_(options), inference_(options != nullptr ? options->get("inference", false) : false) {} DatasetBase(Ptr options) : DatasetBase({}, options) {} virtual Iterator begin() = 0; virtual Iterator end() = 0; virtual void shuffle() = 0; virtual Sample next() = 0; virtual batch_ptr toBatch(const std::vector&) = 0; virtual void reset() {} virtual void prepare() {} virtual void restore(Ptr) {} // @TODO: remove after cleaning training/training.h virtual Ptr options() { return options_; } }; } // namespace data } // namespace marian