.. _program_listing_file_src_models_model_base.h: Program Listing for File model_base.h ===================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/models/model_base.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #pragma once #include #include "marian.h" #include "layers/loss.h" #include "layers/generic.h" namespace marian { namespace models { enum struct usage { raw, training, scoring, translation, embedding }; } } // namespace marian YAML_REGISTER_TYPE(marian::models::usage, int) namespace marian { namespace models { // model = input -> predictions class IModel { public: virtual void load(Ptr, const std::string&, bool markReloaded = true) = 0; virtual void save(Ptr, const std::string&, bool saveTranslatorConfig = false) = 0; virtual Logits build(Ptr graph, Ptr batch, bool clearGraph = true) = 0; virtual void clear(Ptr graph) = 0; }; // criterion = (input, reference) -> loss // @TODO: Is there a better name? class ICriterionFunction { public: virtual ~ICriterionFunction() {} virtual void load(Ptr, const std::string&, bool markReloaded = true) = 0; virtual void save(Ptr, const std::string&, bool saveTranslatorConfig = false) = 0; virtual Ptr build(Ptr graph, Ptr batch, bool clearGraph = true) = 0; virtual void clear(Ptr graph) = 0; }; } // namespace models } // namespace marian